How to solve inconsistent PHP times

Most likely, the issue is with your php server randomly choosing a timezone and therefore having times which are usually either one hour behind or one hour after..

To solve it, right before the ‘mission critical’ area of your script, use date_default_timezone_set() .

An example of this is

date_default_timezone_set('America/Dominica');

Note: you can test your timezone with

echo date_default_timezone_get();

 

You may also like...

Leave a Reply