Randy J. Ray schreef: > In fact, since I'm really just after the short names for the sake of > pretty-printing dates for end-users who aren't impressed by "-08:00" > where they'd expect "PDT", I can use any of the matching zones. It > just seems a waste to have to iterate over the whole set to get the > ones that match a specific offset.
Bad example, as -8:00 is not PDT. PDT is -7:00, but so is MST. Even at the same time, as some regions of the US don't observe summer time. And that even ignores the rest of the world; for example, at this time of year, -4:00 is known as AST, AMT, GYT, and BOT. The only way in which you can ever do something like this is to restrict yourself explicitly to a few timezones, in which case it isn't too hard to iterate over them: my $dt = DateTime::Format::ISO8601->parse_datetime( '20080701T000000-0400' ); print map { $_->short_name_for_datetime($dt) } grep { $_->offset_for_datetime($dt) == $dt->offset } map { DateTime::TimeZone->new(name => $_) } qw/EST5EDT CST6CDT MST7MDT PST8PDT/; Eugene