#!/usr/bin/perl use strict; use POSIX; my @local = localtime(); my @utc = gmtime(); my $timezone_offset = mktime(@local) - mktime(@utc); print "Offset in second(s) from GMT = $timezone_offset\n"; print "Offset in hour(s) from GMT = " . ($timezone_offset / 3600) . "\n";Output:
Offset in second(s) from GMT = 28800 Offset in hour(s) from GMT = 8