RE: [PHP] plugging gmmktime value into gmdate yields incorrect date
| From: | Brad Fuller | Date: | Thu, 15 Feb 2007 20:47:51 +0000 |
| Subject: | RE: [PHP] plugging gmmktime value into gmdate yields incorrect date | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248927@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Terra Frost [mailto:terrafrost@gmail.com]
> Sent: Thursday, February 15, 2007 3:20 PM
> To: Peter Lauri
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] plugging gmmktime value into gmdate yields incorrect
> date
>
> date('Z') on the server producing the incorrect output returns 3600. On
> the other two, I get -18000 and -21600.
>
> That said, I don't see how that'd make a difference. The whole reason
> I'm using the gm* functions, in the first place, is because those are
> supposed to work with a fixed timezone - GMT. Testament to this is the
> fact that gmdate('Z') returns 0 on all three of those.
>
> Peter Lauri wrote:
> > And what are the time zones for those two different machines? And what
> is
> > the time? :)
> >
> > Best regards,
> > Peter Lauri
> >
> > www.dwsasia.com - company web site
> > www.lauri.se - personal web site
> > www.carbonfree.org.uk - become Carbon Free
> >
> >
> > -----Original Message-----
> > From: Terra Frost [mailto:terrafrost@gmail.com]
> > Sent: Thursday, February 15, 2007 8:47 PM
> > To: php-general@lists.php.net
> > Subject: [PHP] plugging gmmktime value into gmdate yields incorrect date
> >
> > I tried running the following script on three different servers:
> >
> > <?php
> > echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
> > ?>
> >
> > On two of the servers, I got 03, 23, 2000 back. On the other,
> > however, I got 03, 22, 2000. This doesn't make any sense to me.
> >
> > On the servers that return the correct date (03, 23, 2000),
> > gmmktime(0,0,0,3,23,2000) returns 953769600. On the server that
> > returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
> > returns 953766000. There's a difference of 3600 between the two,
> > which makes me think that some daylight savings time setting is to
> > blame.
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
I may be way off... but isn't it redundant to use both gmdate() and
gmmktime()? I thought each of these functions were used to convert your
local time into GMT...
So for example if you're GMT+5, the gmmktime() would subtract 5 hours, and
then gmdate() would subtract another 5 hours?
Like I said - I could be way off, but just a thought.
-Brad