PHP strtotime() function wrong by 1 hour? PHP strtotime() function wrong by 1 hour? mysql mysql

PHP strtotime() function wrong by 1 hour?


Europe/London time is not GMT time during Daylight Savings. You need to set it to UTC.

date_default_timezone_set('UTC');

date_default_timezone_set('GMT'); may work, but, as Kenneth notes in a comment below, it is deprecated.


London time zone is expressed in British Summer Time during Summer. Having said that, it's a good practice to store time in UTC and present the time to end user in either UTC or in THEIR local time.

It is also probably wise to ensure that your system time is UTC.


Before PHP 5.3 the strtotime had problems calculating time if you added or deducted months and days etc. That was fixed so you now can tell specifically how you want it calculated, if you are below PHP 5.3 I would recommend doing the date calculating in mysql or upgrade your PHP version.