[San-Diego-pm] Converting Time from UTC

Ken Loomis kloomis at bigplanet.com
Fri Feb 8 11:09:11 PST 2008


I'm not sure what all that is about, but since I moved from San Diego
to Arizona a couple of years ago, any mention of Daylight Saving Time
piques my curiosity.

Since Arizona NEVER goes on to DST, I was wondering if your routine
took that into account.

It is interesting to see which web services/applications give me the
option to select "Arizona" when they ask for my time zone.

Just wondering.

Ken

>
>
>
>---- Original Message ----
>From: chris at chrisgrau.com
>To: san-diego-pm at pm.org
>Subject: Re: [San-Diego-pm] Converting Time from UTC
>Date: Fri, 8 Feb 2008 10:53:54 -0800
>
>>How annoying.  My original reply ended up being rejected by qmail.
>>Better luck this time.  And the error message is oh so useful.
>>
>>    host 16.mx.develooper.com[216.52.237.216] said: 452 Message
>denied
>>    temporarily (in reply to end of DATA command)
>>
>>On Fri, Feb 01, 2008 at 08:39:04PM -0500, Mark Schoonover wrote:
>>> Yeah, that's what I was thinking on the way home tonight... I was
>>> thinking I could just check the date/time to see if it's equal to,
>or
>>> past March 9th, 0200 and go that route, but I think it maybe safer
>to
>>> use DateTime module to do what I need.
>>
>>Ouch.  I would never recommend handling Daylight Saving Time
>manually.
>>Too much room for error.  I whipped up something that may do what
>you
>>want (or may not... I only skimmed this thread).  Notice the second
>two
>>dates fall on the DST switch.
>>
>>-----cut----------cut----------cut----------cut----------cut-----
>>
>>#!/usr/bin/perl -w
>>
>>use strict;
>>use Date::Parse;
>>
>>my @dates = qw(01/01/2007 03/11/2007 11/04/2007);
>>my @times = qw(00:00      08:25      08:09);
>>
>>for my $i ( 0 .. $#dates ) {
>>    my $date = join ' ', $dates[$i], $times[$i];
>>
>>    my $time = str2time( $date, 'GMT' );
>>    print "Got date: ", ( scalar gmtime $time ), " GMT\n";
>>
>>    for my $tz ( qw(US/Pacific US/Mountain US/Central US/Eastern) )
>{
>>        local $ENV{'TZ'} = $tz;
>>        print "    $tz => ", ( scalar localtime $time ), "\n";
>>    }
>>}
>>
>>-----cut----------cut----------cut----------cut----------cut-----
>>
>>Got date: Mon Jan  1 00:00:00 2007 GMT
>>    US/Pacific => Sun Dec 31 16:00:00 2006
>>    US/Mountain => Sun Dec 31 17:00:00 2006
>>    US/Central => Sun Dec 31 18:00:00 2006
>>    US/Eastern => Sun Dec 31 19:00:00 2006
>>Got date: Sun Mar 11 08:25:00 2007 GMT
>>    US/Pacific => Sun Mar 11 00:25:00 2007
>>    US/Mountain => Sun Mar 11 01:25:00 2007
>>    US/Central => Sun Mar 11 03:25:00 2007
>>    US/Eastern => Sun Mar 11 04:25:00 2007
>>Got date: Sun Nov  4 08:09:00 2007 GMT
>>    US/Pacific => Sun Nov  4 01:09:00 2007
>>    US/Mountain => Sun Nov  4 01:09:00 2007
>>    US/Central => Sun Nov  4 02:09:00 2007
>>    US/Eastern => Sun Nov  4 03:09:00 2007
>>

Ken Loomis
Consultant
Windows, Macintosh, Internet, etc.
Helping to make your technology
experience more pleasant & profitable ;-)
619-275-6919
Fax: 267-220-6919
KLoomis at BigPlanet.com



More information about the San-Diego-pm mailing list