Hi All
This is probably a ridiculously easy question but as a non coder I really need your help.
Below is the code my programmer did before he left the company. Problem is that, when the the clocks turned back on Sunday, the time on my website is an hour ahead of the actual time in South Africa ( which is supposed to be GMT +2 )
id="srvdate"><? print date("d F Y H:i:s", time())?>
Does anyone know how or what I need to add to the above or is this coding far too little info for you to work with ?
PHP CLOCK
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: PHP CLOCK
There are a few example of dealing with daylight savings in the manual - dates. More specifically, you will use date('I') to determine whether you are in daylight savings, and therefore need to make the adjustments (preferably using mktime()).
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: PHP CLOCK
Code: Select all
$gmtTime = date_create("now", new DateTimezone('GMT');
$gmtTime->setTimezone(new DateTimezone('Africa/Johannesburg');
$localTime = $gmtTime->format("d F Y H:i:s");
echo $localTime;
-
Hilton PRLBET
- Forum Newbie
- Posts: 2
- Joined: Wed Apr 01, 2009 10:15 am
Re: PHP CLOCK
Thank you both - problem solved !!!