This isn't Symfony specific, but thought one of ya PHP gurus might be 
able to help.

I have some time zone strings (ex: "America/New_York" or 
"Europe/London"), and want to find the GMT offset of that timezone, 
*without DST adjustments*. In other words, the offset (like GMT -5) that 
I print should be consistent throughout the year.

The first part I've figured out; how to easily remove DST adjustments I 
haven't. For example, for Europe/London, I get GMT+1 right now, where I 
want GMT+0, as it will be during London's winter.

        $dateTimeZone = new DateTimeZone($timeZoneString);
        $dateTime = new DateTime("now", $dateTimeZone);
        $offset = $dateTimeZone->getOffset($dateTime);
        if ($offset != 0) {
            $offset = $offset / (60 * 60); //converts to hours
        }

Switching the timezone setting with date_default_timezone_set() or 
putenv('TZ=') can have side-effects, so something that doesn't involve 
tricking the thread into thinking it's in a different timezone would be 
best.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to