[NCLUG] perl datestring to timestamp conversion ?

Jake Edge jake at edge2.net
Mon Jan 10 12:58:45 MST 2005

Gabriel Somlo wrote:

> So I was more like trying to find out if I can wrap something like:
> 	{
> 		save localtime;
> 		set localtime to utc
> 		call mktime to get a timestamp
> 		restore saved localtime
> 	}
> around mktime if it's a UTC thing, and not wrap anything around mktime
> if it's not utc...

You may be able to use the TZ environment variable to do this ... I have 
in the past ... I suspect it may not work on windoze, but I don't know:

my $savtz = $ENV{TZ};
$ENV{TZ} = blah

stuff using new timezone

if (defined($savtz)) {
     $ENV{TZ} = $savtz;
else {

I also recently saw an announcement of a CPAN module to do this kind of 
thing ... I don't think it existed when I wrote the code above (~2 years 
ago) ...

You may have more luck asking in a perl specific email list ...


Jake Edge - jake at edge2.net - http://www.edge2.net

More information about the NCLUG mailing list