[wp-hackers] Changing the clock format in Write > Post

Otto otto at ottodestruct.com
Wed May 7 14:37:43 GMT 2008


On Wed, May 7, 2008 at 9:29 AM, Jennifer Hodgdon <yahgrp at poplarware.com> wrote:
> Maybe there's enough in the core of PHP to support them in an easy way
> (haven't looked into it recently), but if not, good luck!

If you run PHP 5.1 or up, this code will figure out the correct offset
from the server for a given timezone string (like "America/Chicago"):

$dateTimeZone = new DateTimeZone('America/Chicago');
$dateTimeServer = new DateTime();
$timeOffset = $dateTimeZone->getOffset($dateTimeServer);
$timeOffset = $timeOffset / 3600;

The resulting $timeOffset is in hours, and will be what you should
choose on the Settings->General page. That's the basis for the plugin.


More information about the wp-hackers mailing list