in reply to Re^5: Time zones
in thread Time zones

Okay! Since is was local and in a block that's what I tought might be happening but I wasn't really sure. Thaks for everyones patience. I ran the following code on a machine that is Eastern Time. It printed out the same time in all the print statements.
use strict; use warnings; print scalar(localtime),"\n"; { local $ENV{'TZ'} = 'GMT'; print scalar(localtime),"\n"; local $ENV{'TZ'} = 'EST5EDT'; print scalar(localtime),"\n"; } print scalar(localtime),"\n";

Replies are listed 'Best First'.
Re^7: Time zones
by Anonymous Monk on Sep 27, 2004 at 20:34 UTC
    It should have printed different times right? Boy, this would be a whole lot easier the other way around. I could just call gmtime() on an EST box. Too bad I can't call estime() from a GMT!
Re^7: Time zones
by sgifford (Prior) on Sep 27, 2004 at 21:16 UTC

    Yup, it did for me too. Guess you'll have to try one of the other ideas posted here. :)

    FWIW, it does work if you set TZ before starting Perl:

    $ TZ='GMT' perl -e 'print localtime()."\n"'; Mon Sep 27 21:11:30 2004 $ TZ='EST5EDT' perl -e 'print localtime()."\n"'; Mon Sep 27 17:11:38 2004 $ TZ='MST' perl -e 'print localtime()."\n"'; Mon Sep 27 14:11:50 2004