Re: Unix date

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

 



On Dec 28, 2007 10:46 AM, tedd <tedd@xxxxxxxxxxxx> wrote:

> Hi gang:
>
> Using:
>
> $unix_in = 1255845600;
>
> echo(date("M d, Y h:i:s a",$unix_in));
>
> On one sever, produces: Oct 18, 2009 02:00:00 am
>
> But on another sever, produces: Oct 18, 2009 12:00:00 am
>
> This difference appears to be a combination of "time-zone" and
> "daylight-savings" considerations. In other words, the function
> date() looks at the server's time (whatever that is set for, right or
> wrong) and uses that for the calculation.
>
> So, what's the best method in keeping things consistent across
> servers? Is there one?


assuming you have the
date.timezone
php.ini directive set appropriately on each system and they are in different
timezones, the values will not be the same.  if you want to get the same
time
you can go for GMT;

$unix_in = 1255845600;
echo(gmdate("M d, Y h:i:s a",$unix_in));

-nathan

[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