timezone - Problems with PHP time zone wrongly set -


i have problem php not reflecting correctly actual time, result server's scripts 5 hours in future.

if run in thecommand line got. (centos5) ..

[root@server ~]# date sat may  4 11:20:17 cdt 2013 

which correct (im mexico , server has correct time zone , time set), how ever doing in php get...

[root@server ~]# php -r 'echo gmdate("d, d m y h:i:s e")."\n";' sat, 04 may 2013 16:18:45 utc 

as can see time hours in future, , php.ini supposed have correct time zone defined.

[date] ; defines default timezone used date functions date.timezone = america/mexico_city 

so can problem here?

gmdate() returns time according gmt (greenwich mean time) (although not same) used interchangeably utc. said right you're in cdt 5 hours behind utc (because daylight savings time in effect).

if want scripts generate datetime strings reflect time zone set in php.ini file should use date() function. better yet, start using datetime library.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -