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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
edwinzhang
Forum Newbie
Posts: 2
Joined: Mon Jan 14, 2008 11:19 pm

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

Post 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?
User avatar
jimthunderbird
Forum Contributor
Posts: 147
Joined: Tue Jul 04, 2006 3:59 am
Location: San Francisco, CA

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

Post by jimthunderbird »

The time is the same, just the display format is different. Check http://us.php.net/date for formatting details.
edwinzhang
Forum Newbie
Posts: 2
Joined: Mon Jan 14, 2008 11:19 pm

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

Post by edwinzhang »

I am pretty sure the time is different, time() returns local time, which means server local time.
Post Reply