[Israel.pm] How to set timezone in perl

Mikhael Goikhman migo at homemail.com
Mon Dec 29 09:37:07 PST 2008

On 28 Dec 2008 17:34:55 +0200, Chanan Berler wrote:
> When I am trying to run this command on WinVista I get these error message? 
> Q: How can I work the time zone in perl ? 

On POSIX systems you may set environment variable TZ and then maybe call
system's `/bin/date` from perl or call POSIX::tzset(). I don't know
whether this works in a non-POSIX system, like yours. perldoc POSIX.

perl -MPOSIX -le '$ENV{TZ} = "Asia/Tokyo"; POSIX::tzset; print scalar localtime'

In any case, it is always possible to implement your own calculations.
Timezone is just an offset of M minutes (usually whole hours) from the
Greenwich time. CPAN has many answers too.


perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'

More information about the Perl mailing list