Re: stftime differences on Windows/Linux platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Robin,

Thanks for your reply. The times are exactly synchronized. I'm looking
at the date section in the output of phpinfo(), and get the following:

Development:

D:\Documents and Settings\neil.saunders>date
The current date is: 06/11/2007
D:\Documents and Settings\neil.saunders>time
The current time is: 12:47:06.46

date
date/time support 	enabled
Timezone Database Version 	2006.16
Timezone Database 	internal
Default timezone 	Europe/London

Directive	Local Value	Master Value
date.default_latitude	31.7667	31.7667
date.default_longitude	35.2333	35.2333
date.sunrise_zenith	90.583333	90.583333
date.sunset_zenith	90.583333	90.583333
date.timezone	no value	no value

Production:

 [~]# date
Tue Nov  6 12:49:25 GMT 2007

date
date/time support 	enabled
Timezone Database Version 	2006.16
Timezone Database 	internal
Default timezone 	UTC

Directive	Local Value	Master Value
date.default_latitude	31.7667	31.7667
date.default_longitude	35.2333	35.2333
date.sunrise_zenith	90.583333	90.583333
date.sunset_zenith	90.583333	90.583333
date.timezone	no value	no value

Although the timezones are different, my understanding is the UTC is a
synonym for GMT, which is based in London. This appears to be
confirmed by looking at the default latitudes and longitudes and they
match up.

Either way, setting the timezone to Europe/London in production fixed
the issue. Thanks again for your help.

Cheers,

Neil.

On Nov 6, 2007 12:01 PM, Robin Vickery <robinv@xxxxxxxxx> wrote:
>
> On 06/11/2007, Neil Saunders <n.j.saunders@xxxxxxxxx> wrote:
> > Hi All,
> >
> > I'm experiencing some differences in in the return values of strftime
> > on Windows & Linux platforms on PHP 5.2.1. I've knocked up a test case
> > to demonstrate the bug:
> >
> > <?php
> >
> > $UNIX_TIME = mktime(0,0,0,5,31,2008);
> > echo "Time Made for 31-05-2008:                  $UNIX_TIME\n";
> > echo "Expected Time for 31-05-2008:              1212188400\n";
> > echo "Formated generated:                        " .
> > strftime("%d-%m-%Y", $UNIX_TIME) . "\n";
> > echo "Formated expected:                         " .
> > strftime("%d-%m-%Y", 1212188400) . "\n";
> > echo "Difference between expected and generated: " . ($UNIX_TIME - 1212188400);
> > echo "\n\n";
> > ?>
> >
> > OUTPUT DEVELOPMENT:
> >
> > C:\>php -e c:\test.php
> > Time Made for 31-05-2008:                  1212188400
> > Expected Time for 31-05-2008:              1212188400
> > Formated generated:                        31-05-2008
> > Formated expected:                         31-05-2008
> > Difference between expected and generated: 0
> >
> > OUTPUT PRODUCTION:
> >
> > Time Made for 31-05-2008:                  1212192000
> > Expected Time for 31-05-2008:              1212188400
> > Formated generated:                        31-05-2008
> > Formated expected:                         30-05-2008
> > Difference between expected and generated: 3600
> >
> > Development Config:
> > ------------------------------------
> > PHP Version 5.2.1
> > PHP API     20041225
> > PHP Extension     20060613
> > Zend Extension     220060519
> >
> > Production Config:
> > ------------------------------------
> > PHP Version 5.2.1
> > Build Date     Apr 25 2007 18:04:12
> > PHP API     20041225
> > PHP Extension     20060613
> > Zend Extension     220060519
> >
> > Am I missing something obvious here? Any help gratefully received.
>
> Well, either the clocks on your dev and production servers are exactly
> 6 hours out or there's a difference in their locale settings such that
> one thinks it's in a timezone 6 hours ahead of the other.
>
> -robin
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux