rtremaine has asked for the wisdom of the Perl Monks concerning the following question:

I need to determine if a specific date in the past occurred when daylight savings time was in effect. I am aware of ways to determine if daylight savings time is currently in effect by using Date::Calc but have not been able to find any info on past dates. My source date is in GMT and I need to convert to CST with a proper daylight savings time offset. An example date format is “2004-04-15 22:00:00”. Could be I just missing something simple here? Thanks again Randy T

Replies are listed 'Best First'.
Re: Daylight Savings Time Determination
by simonm (Vicar) on Dec 07, 2004 at 18:27 UTC
    Use DateTime:
    my $dt = DateTime::Format::ISO8601->new(); $dt->parse_datetime( $date_string ); print( $dt->is_dst ? 'Y' : 'N' )

    Update: fglock is right; use the syntax he shows in his reply to the OP.

      DateTime::Format::ISO8601->new() returns a parser object, not a "DateTime" object.
      You can use the parser as a "DateTime" factory.

Re: Daylight Savings Time Determination
by fglock (Vicar) on Dec 07, 2004 at 20:16 UTC

    In order to do this, you have to choose a time zone.
    I assume you mean "London":

    use DateTime::Format::ISO8601; my $parser = DateTime::Format::ISO8601->new(); my $dt = $parser->parse_datetime( '2004-10-05' ); $dt->set_time_zone( 'Europe/London' ); print( $dt->is_dst ? 'Y' : 'N' )
Re: Daylight Savings Time Determination
by dragonchild (Archbishop) on Dec 07, 2004 at 18:16 UTC
    Have you tried just converting it? Date::Calc, in my experience, usually does the right thing.

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Re: Daylight Savings Time Determination
by VSarkiss (Monsignor) on Dec 07, 2004 at 20:27 UTC