Reputation: 109
My php script shows time by this
echo "<a href=\"time.php?hits=$hits\">".date("h:i:s A")."</a></div>";
Problem is server time is different from us. Server gives 11 hours back time from my current zone. If my real time is 15 Aug 10 PM server is showing 15 Aug 11 AM!
How can I fast my clock 11 hours on above script?
Upvotes: 0
Views: 161
Reputation: 16297
date_default_timezone_set('America/Los_Angeles');
you can get list of time zones here http://www.php.net/manual/en/timezones.america.php
Upvotes: 1
Reputation: 131
GOOGLE "PHP timezones change"
putenv("TZ=Europe/London");
or if that produces an error:
date_default_timezone_set('Europe/London');
if you can gain access to your php.ini
date.timezone = "Europe/London"
in the ini
ini_set('date.timezone', 'Europe/London');
OR
for your solution here it is date('h:i:s A', time()+36000)
just adjust the seconds my friend
Upvotes: 2
Reputation: 229
date_default_timezone_set. This changes the time zone for all date-function calls. (See Manual.)
Upvotes: 1