Page 1 of 1

php time function bug, does anyone know how to solve it?

Posted: Mon Jan 14, 2008 11:24 pm
by edwinzhang
Just meet a very odd time() problem.

Service time is: 'Mon Jan 14 22:47:15 CST 2008', I get this string by executing date in shell.
but php function date('Y-m-d H:i:s') returns '2008-01-15 10:47:15'.

My php version is 4.3.2. Do you have any clue what cause this?

Re: php time function bug, does anyone know how to solve it?

Posted: Mon Jan 14, 2008 11:59 pm
by jimthunderbird
The time is the same, just the display format is different. Check http://us.php.net/date for formatting details.

Re: php time function bug, does anyone know how to solve it?

Posted: Tue Jan 15, 2008 12:41 am
by edwinzhang
I am pretty sure the time is different, time() returns local time, which means server local time.