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

I'm having a problem parsing a time zone with the DateTime module.
my $start_dt = DateTime->new( year => $start_year, month => $start_month, day => $start_day, hour => $start_hour, minute => $start_minute, second => $start_second, nanosecond => 000000000, time_zone => "$start_tz" );
the $start_tz variable is parsed out of a record, and contains the old formatting for TZs. CST6CDT, PST8PDT, etc..etc.. however it is choking on MST7 with the error: "Invalid offset: MST7" Seems to process other timezones fine.

Replies are listed 'Best First'.
Re: MST time Zone
by ikegami (Patriarch) on Jul 08, 2010 at 16:59 UTC
    >perl -MDateTime::TimeZone -le"print for DateTime::TimeZone->all_names +" ... CET CST6CDT EST EST5EDT ... HST ... MST MST7MDT PST8PDT ...

    You could create a lookup table (hash) to convert from the strings you have to the strings DT wants.