Here’s a throwaway WordPress post for you.
Recently, our comments started having weird timestamps. Like, 4 hours in the future to be exact. What was happening was that instead of ‘local time’ being used, WordPress (or maybe Disqus) was using ‘UTC’ time. UTC time is 4 hours ahead of local time, so that seemed to be it. Not sure what caused it, but the most recent PHP 5 build was June 30, so that could be it.
Anyhow, to fix it, edit your wp-settings file and look for the following line:
date_default_timezone_set(‘UTC’);
You have two choices: change UTC to its descriptive locale like this (use the locale where you reside)
date_default_timezone_set(‘America/Phoenix’);
Or use the UTC offset like this:
date_default_timezone_set(‘UTC -7′);
That’s it. Test it out by commenting to yourself in the most lonely way possible and then check the comment timestamp and see if it’s using local time.
Weird Timezone Issues in WordPress
Here’s a throwaway WordPress post for you.
Recently, our comments started having weird timestamps. Like, 4 hours in the future to be exact. What was happening was that instead of ‘local time’ being used, WordPress (or maybe Disqus) was using ‘UTC’ time. UTC time is 4 hours ahead of local time, so that seemed to be it. Not sure what caused it, but the most recent PHP 5 build was June 30, so that could be it.
Anyhow, to fix it, edit your wp-settings file and look for the following line:
date_default_timezone_set(‘UTC’);
You have two choices: change UTC to its descriptive locale like this (use the locale where you reside)
date_default_timezone_set(‘America/Phoenix’);
Or use the UTC offset like this:
date_default_timezone_set(‘UTC -7′);
That’s it. Test it out by commenting to yourself in the most lonely way possible and then check the comment timestamp and see if it’s using local time.