in reply to Re^3: Timezone antidote
in thread Timezone antidote
GMT is the storage solution, not the output format. Store all the times in UTC/GMT, and when you actually need to print them out, then use TZ-aware tools and use the localtime features.
From one of my scripts, I have:
the hatter
For the machines in the UK, that changes between -1 and -0 for summer and not, and the machines in germany, that changes between -2 and -1 for summer and winter, and locale is de_DE. Calling localtime() will then view the time as it should be in your locale.use POSIX qw(LC_TIME); $ENV{'TZ'} = "GMT-1"; $locale = "gb_UK"; POSIX::setlocale(LC_TIME,$locale); my $todaysdate = POSIX::strftime("%a %b %d %H:%M",localtime());
the hatter
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Timezone antidote
by Andre_br (Pilgrim) on Sep 06, 2005 at 17:11 UTC | |
by hatter (Pilgrim) on Oct 21, 2005 at 13:21 UTC |
In Section
Seekers of Perl Wisdom