I'm trying to break out a timestamp into it's appropriate fields, like 
so:

my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = 
localtime($my_time);

but no matter if I use localtime or gmtime, $my_time gets analyzed as either in 
the server's timezone or in UTC.  I need to break apart the timestamp in 
$my_time without it being changed.  In other words, I'm trying to get $hour, 
$min, $sec, etc, in _my_ timezone, not the server's nor in UTC.

        I finally got it to work using:

$ENV{'TZ'} = $main::global->{'config'}->{'timezone'};
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime();

but I read somewhere that this may cause problems depending on the platform (?) 
or something.  I can't find it again.  Is this solution O.K. to use, or is 
there a better way to do what I'm after?

        I know that I can use DateTime for this, but I'm trying to see what I 
can do without it.

Thanks,
Frank

SurfShopCART
https://github.com/surfshopcart/surfshop
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to