Great! That does the trick. I never knew about the "clone" method and "is_dst" on itself is not available as method inside DateTime::TimeZone but together it's excactly what i need.
thanks very much. Ewald... On Wed, Mar 26, 2008 at 01:01:03PM -0700, Tatsuhiko Miyagawa wrote: > On Wed, Mar 26, 2008 at 11:34 AM, Ewald Beekman <[EMAIL PROTECTED]> wrote: > > Is there a way to see if DST is in effect on a > > returned time zone object ? > > For instance, i have got a loop like this: > > > > my @list = DateTime::TimeZone->all_names; > > foreach $zone (@list) { > > next unless ($zone =~ /\//); # skip timezone > > links in the list > > $dt = DateTime->now(); # current computer > > time > > $tz = DateTime::TimeZone->new( name => $zone ); # timezone > > > > $offset = $tz->offset_for_datetime($dt); # offset from UTC > > for this timezone > > $TZ = $tz->short_name_for_datetime($dt); # timezone name > > (e.g. CET) > > $dt->add(seconds => $offset); # convert computer > > time to time in timezone > > $hoffset = $offset / 3600; # offset in hours > > > > printf "%40s\t%s\tGMT diff = %g\t%4s\t",$zone,$TZ, $hoffset,$DST; > > printf "%d/%02d/%02d > > %02d:%02d\n",$dt->year,$dt->month,$dt->day,$dt->hour,$dt->minute; > > } > > > > How can i see for each zone displayed if it is in DST? > > is_dst() method does it for you. > > if ($dt->clone->set_time_zone($tz)->is_dst) { > # it's in DST now > } > > HTH -- http://www.oiepoie.nl ## Your mind-mint is: "People should have access to the data which you have about them. There should be a process for them to challenge any inaccuracies." -- Arthur Miller