On Wed, 9 Mar 2005, Rick Brewer wrote:

I was able to obtain this list myself just by making use of DateTime and
DateTime::TimeZone. Code here for anyone interested:
+++
#!perl
# Generate lists of timezones sorted alphabetically and by offset

use DateTime;
use DateTime::TimeZone;

my $names = DateTime::TimeZone->new(name => 'America/Chicago');
my @valid = $names->all_names;
my $i = 0;

$timelist = time();
my ($sec, $min, $hour, $day, $nmonth, $year, $wday, $day_of_year,
$isdst) = localtime($timelist);

$nmonth = $nmonth + 1;

$year += 1900;

local @zone_array;

for ($i=0;$i<=$#valid;$i++) {
  my $zone = DateTime::TimeZone->new( name => $valid[$i] );
  my $dt = DateTime->new(year=>$year, month=>$nmonth,day=>$day,
                           hour=>$hour,minute=>$min,
                           time_zone => $valid[$i]);

my $offset = $zone->offset_for_datetime($dt);

But this is just the offset at this moment in time. Some will change over time and some won't.



-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

Reply via email to