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

I'm looking for a script that will return true if the date falls in daylight savings time (summer time) based on a set of rules (e.g., starts 1st Sunday in April ends 1st Sunday in October or such).

Someone must have done this.

Replies are listed 'Best First'.
Re: Daylight Savings
by Fletch (Bishop) on Apr 14, 2005 at 19:42 UTC

    Erm, let the OS do it. (localtime( $time_t ))[8] should be correct for the native time zone. If you need that for a time zone other than the system's naitive one use do { local $ENV{TZ} = "XYZ"; (localtime( $time_t ))[8]} instead.

    Getting your date as a time_t is of course an exercise for the reader (see Time::Local or something like Date::Parse).

      Sounds like a reasonable way to go. The server should have the correct local time in its location.
Re: Daylight Savings
by RazorbladeBidet (Friar) on Apr 14, 2005 at 18:38 UTC
    Net::ICal::Daylight says:
    This module represents a DAYLIGHT section in a VTIMEZONE, which details information about when a particular timezone is on daylight savings time. It includes information about when the switch back to standard time happens.
    --------------
    "But what of all those sweet words you spoke in private?"
    "Oh that's just what we call pillow talk, baby, that's all."
      Unfortunately the site hosting my webpages doesn't have it installed. I need something I can incoporate in a CGI script using GMT