Search code examples
phpdateclocksetting

php date.timezone problem


i am storing member's created date using the time() function, and echo them back using strftime() and the date() function, but it doesnt display the right time information

my code is :

date("d-m-Y H:i:s", $member->created)
strftime("%Y-%m-%d",$member->created)

it should have displayed this:

17-11-2010 14:42

rather than:

17-11-2010 23:45

now, i have change my php.ini date.timezone configuration into my current time zone which is "Asia/Jakarta", yet nothing change. i have also try to set them manually inside my code using

date_default_timezone_set("Asia/Jakarta");

what did i miss ? please help me

Regards

EDIT:

according to Noodles, i need to check the server's clock setting, so i did using the hwclock command, and it turns out that the clock setting is not right, since it displayed

Thu 18 Nov 2010 02:07:25 AM WIT  -0.931691 seconds

while it should have been

Wed 17 Nov 2010 05:04:ss PM

now, how can i syncronize this setting into my timezone ??

Edit: i have manage to change the clock setting using

date -s "HH:MM:SS"
hwclock --systohc

thanks for pointing me out Noodles

case is closed i guess :D

thanks again guys


Solution

  • Are you sure your server's clock is set correctly? It would seem weird that the minutes would change. At the most I'd expect the hours to change if it was a different time zone, but not minutes.