jasonc Posted September 24, 2010 Share Posted September 24, 2010 I have using gmdate() to get the GMT time but as it does not take in to account daylight saving the time is one hour behind. Does anyone have a fix that can work out the correct time what ever time of year it is? As I am currently having to change the code each time the time changes. Quote Link to comment https://forums.phpfreaks.com/topic/214264-how-to-get-correct-gmdate/ Share on other sites More sharing options...
salathe Posted September 24, 2010 Share Posted September 24, 2010 gmdate will get the correct time in GMT... however that is not what you want (obviously). There are a couple of ways, here's two. // I'm assuming this is the timezone you really want // It could also (instead) be set in a .htaccess or php.ini file date_default_timezone_set('Europe/London'); $now = date($format); $now = date_create('now', new DateTimeZone('Europe/London'))->format($format); Quote Link to comment https://forums.phpfreaks.com/topic/214264-how-to-get-correct-gmdate/#findComment-1114923 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.