[sf-perl] Getting the timezone

Steve Fink sphink at gmail.com
Mon Nov 20 16:30:10 PST 2006

On 11/20/06, David Alban <extasia at extasia.org> wrote:
> On 11/17/06, Michael Friedman <friedman at highwire.stanford.edu> wrote:
> > formatted as readable text or
> >         system('date +%z');
> >
> > which even formats it in RFC-2822 format like you want it.
> Yes, this is indeed the format I want.  However, I don't want to spawn
> a shell and add an extra process.  I generally don't like using
> system() or qx{} if I can avoid doing so.

use POSIX qw(strftime);
my $offset = strftime("%z", localtime);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20061120/713bedc4/attachment.html 

More information about the SanFrancisco-pm mailing list