Timezones 
Author Message
 Timezones

Hi,

I know about localtime & gmtime routines, but does anyone know how to
convert from GMT to anyother timezone without having to know the hours
difference.  IE just give the routines the country code or something...

Thanks,

Rob Donovan

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.*-*-*.com/ - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



Sat, 02 Aug 2003 05:36:50 GMT  
 Timezones

Quote:

> Hi,
> I know about localtime & gmtime routines, but does anyone know how to
> convert from GMT to anyother timezone without having to know the hours
> difference.  IE just give the routines the country code or something...

If your computer has a timezone database (most UNIX do, I don't know
about Win32), then set $ENV{'TZ'} and call localtime...

Quote:
> cat /tmp/perl

#!/usr/bin/perl -w
$t = time;
print $ENV{'TZ'}, "\n";
print scalar localtime $t, "\n";
$ENV{'TZ'} = "US/Eastern";
print $ENV{'TZ'}, "\n";
print scalar localtime $t, "\n";
Quote:
> perl /tmp/perl

US/Pacific
Mon Feb 12 17:48:15 2001
US/Eastern
Mon Feb 12 20:48:15 2001

--

Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
      < Please move on, ...nothing to see here,  please disperse >



Sat, 02 Aug 2003 09:55:06 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Timezones

2. Convert GMT to North American timezones

3. Module for timezones

4. How to get times in different timezones?

 

 
Powered by phpBB® Forum Software