Re: Daylight savings time timezone conversion automatically?

[email protected] (Rick Measham)
Newsgroups perl.datetime
Message-ID <[email protected]>
William Heath wrote:
> The
> trouble is I need to find the GMT offset for a timezone and I don't
> know how to do this correctly for daylight saving time. 

my $dt = new DateTime(
	year => 2008,
	month => 3,
	day   => 12,
	hour  => 16,
	time_zone => 'Australia/Melbourne'
);

print $dt->offset; # in seconds
# 39600

printf( "%s%02d%02d",
	$dt->offset >= 0 ? '+' : '-',
	int($dt->offset / 60 / 60),
	($dt->offset / 60) % 60
);
# +1100
-- 
Message  protected for iSite by MailGuard: e-mail anti-virus, anti-spam and content filtering.
http://www.mailguard.com.au
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.