Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Re: Determining Daylight Savings Time

by Starky (Chaplain)
on May 29, 2002 at 21:44 UTC ( #170229=note: print w/replies, xml ) Need Help??

in reply to Re: Determining Daylight Savings Time
in thread Determining Daylight Savings Time

Thanks for your reply!

The reason is that I'm doing timezone conversion. The code is supposed to be high-availability ... it is very bad if times get snookered even a couple times a year.

I'm using Date::Manip to perform the conversion. Date::Manip understands MST and MDT, but it does not understand something like MST7MDT. For example,

#!/usr/bin/perl use strict; use Date::Manip; my $date = &ParseDate("2002-05-29 08:00:00"); print "The unconverted date is [".&UnixDate($date,"%Y-%m-%d %H:%M:%S") +."]\n"; my $from = 'MDT'; my $to = 'GMT'; my $converted = &Date_ConvTZ($date,$from,$to); print "The conversion from [$from] resulted in [".&UnixDate($converted +,"%Y-%m-%d %H:%M:%S")."]\n"; $from = 'MST7MDT'; $converted = &Date_ConvTZ($date,$from,$to); print "The conversion from [$from] resulted in [".&UnixDate($converted +,"%Y-%m-%d %H:%M:%S")."]\n";
The unconverted date is [2002-05-29 08:00:00] The conversion from [MDT] resulted in [2002-05-29 14:00:00] The conversion from [MST7MDT] resulted in [2002-05-29 08:00:00]

So I need to know whether a given date is in Mountain Daylight Time or Mountain Standard Time.

Edit by tye to change PRE tags to CODE tags

Replies are listed 'Best First'.
Re: Re: Re: Determining Daylight Savings Time
by maverick (Curate) on May 29, 2002 at 22:01 UTC
    So essentially the problem is that Date::Manip doesn't understand MST7MDT and gives you GMT? Maybe you could look at the internals of Date::Manip and add that timezone? Perhaps a different CPAN module would do the trick...Date::Handler looks promising..


    OmG! They killed tilly! You *bleep*!!

(MeowChow) Re3: Determining Daylight Savings Time
by MeowChow (Vicar) on May 30, 2002 at 19:23 UTC
    I'm fairly certain that Time::ParseDate correctly handles the AAAXBBB timezone format.

    Update: Whoops, I'm fairly certain I'm wrong.

                   s aamecha.s a..a\u$&owag.print

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://170229]
[choroba]: sell to whom? Burglars?
[marto]: think targeted ads
[marto]: "your house is so big, consider product XYZ", "You clean a lot, consider product ABC"
Discipulus your house is so small, accept dollars from nigeria
[marto]: Discipulus, or space saving products, that sort of thing

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-07-26 12:03 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (390 votes). Check out past polls.