Simmons Consulting, the Website of Toby Simmons

WordPress, IIS, timezone auto updating!

04
Feb

Most folks running WordPress use some flavor of Unix/Linux and Apache. If you are like me and run WordPress on IIS, it can be frustrating at times because you tend to feel a bit like a stepchild. There are several cool plugins for WP out there, but many just don’t run on Windows, at least not without heavy modifications.

One particular issue about WP that had driven me crazy was the issue of having to manually update your timezone offset every time daylight savings time started or ended. There is a plugin that is supposed to make this adjustment automagically for you based on either the server settings or the specified timezone setting you give it. The problem is that the plugin didn’t work on Windows. However, you can make it work by editing one line of the plugin.

The problem is due to the different way the strftime() function works on *nix vs. Windows. However, with one small edit you can make the plugin work on Windows.

Go to line 150 (of version 2.3 of the plugin, the latest as of this writing) and replace:

  1.    $offset = strftime('%z', time());

with

  1.    $offset = date('O');

You can now specify your timezone and it should automatically (as if by magic!) change the offset from GMT for you. Now stop feeling sorry for yourself!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>