develooper Front page | perl.datetime | Postings from January 2006

Re: Daylight Saving

Thread Previous | Thread Next
From:
Yitzchak Scott-Thoennes
Date:
January 20, 2006 12:47
Subject:
Re: Daylight Saving
Message ID:
20060120204709.GA2664@efn.org
On Fri, Jan 20, 2006 at 10:59:50AM -0500, Garrett, Philip (MAN-Corporate) wrote:
> > -----Original Message-----
> > From: Bill Moseley [mailto:moseley@hank.org] 
> > Sent: Friday, January 20, 2006 10:26 AM
> > To: datetime@perl.org
> > Subject: Daylight Saving
> > 
> > I have a zipcode table that lists the city, state, timezone offset (eg
> > -5) and a flag indicating if the location uses daylight saving time
> > for U.S. zipcodes. I don't have the Olson name in the table.
> > 
> > How do I set the timezone in this case -- taking into account the dst
> > settings?
> 
> It looks like DateTime::TimeZone doesn't support offsets with DST.
> 
> You could use a brute force approach where you choose a single Olson
> name to go with each offset/dst combination.
> e.g. (just guessing at these)
>     GMT-0500(DST) => America/New_York
>     GMT-0500      => America/Indiana/Indianapolis
>     GMT-0800(DST) => America/Los_Angeles
>     
> Then, put that Olson name in the table and use it.
> It's not exactly elegant, but it'd probably get you what you want.

Just use the Olson

  PST8PDT
  MST7MDT
  MST
  CST6CDT
  EST5EDT
  EST

zones.  I assume there aren't PST and CST zones because they
aren't actually in use, but if they are needed, maybe you could use
DateTime::TimeZone::OffsetOnly?

Is there a reason the Olson etcetera file isn't included in DT::TZ?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About