Date('Y-m-d H:i:s') not showing my system time

I write simple date function to get current date and time of my local system.

 <? echo date('Y-m-d H:i:s'); ?>


I am surprised, it’s showing “2008-03-13 07:12:35” where as windows’s clock time is 12.45.

Is the server running on your computer? That date/time is the date/time set on the server - not on a local computer. Note that the server time can also be adjusted from the time on the computer it is running on via an appropriate env() call or via an entry in the php.ini

Yes server is running on same computer. My local system is working as client and server. I have not set value in php.ini file on runtime.

In phpinfo() under Date tab “Default timezone” set as “UTC”.

Oh I get the solution. Problem is due to default time zone. Now i reset my timezone and now date() function returns correct value.

echo date('Y:m:d H:i:s');

For timezone ref. to

Thanks Felgall, for quick response.