creating dates from 3-tuples

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Given a 3-tuple of some day, month, and year that checkdate would
return true for, how would I go about converting that day, month, and
year to something like September 3, 1997 using gmdate?
mktime(0,0,0,$month,$day,$year) doesn't seem to work as often as it
should (it'll occasionally return September 2, 1997 when it should
return September 3, 1997).
mktime(0,0,0,$month,$day,$year)+date('Z')+60*60*date('I') seems to work
occasionally, too, but again, it doesn't work all the time.  Would
gmmktime(0,0,0,$month,$day,$year) work all the time?  It works with the
limited testing I've been able to subject it to, thus far, but I don't
know if it'd work all the time.

Alternatively, what about
gmmktime(0,0,0,$month,$day,$year)+date('Z')+60*60*date('I')?  With the
limited testing that I've done on that, it seems to work, too...

As for why I'm using gmdate - I'm trying to modify an existing
application, and am trying to use an existing function that already
uses gmdate.  I don't want to change gmdate to date because, although
that might (or might not; I haven't tried it), I'd risk breaking other
things that used that same function...

Re: creating dates from 3-tuples

yawnmoth wrote:
Quoted text here. Click to load it

Timezone artefact. Don't mix mktime() and gmdate(). Use mktime() and
date(), or gmmktime() and gmdate(), depending on what the parameters
represent. See

E. Dronkert

Site Timeline