Hello,
I am trying to figure out a way to convert the timestamps in a dataset from one timezone (which has daylight savings) to UTC.
2009-02-25 23:57:22,000D60727B89,221.16.86.23,SYSTEM1
What would be the best way to approach this?
Hello,
I am trying to figure out a way to convert the timestamps in a dataset from one timezone (which has daylight savings) to UTC.
2009-02-25 23:57:22,000D60727B89,221.16.86.23,SYSTEM1
What would be the best way to approach this?
Use Perl's Time::Local module. This has 2 functions you can use...
I tried but got the following:
This code taken from here
<CODE>
#-----------------------------
use Time::Local;
$TIME = timelocal($sec, $min, $hours, $mday, $mon, $year);
$TIME = timegm($sec, $min, $hours, $mday, $mon, $year);
#-----------------------------
# $hours, $minutes, and $seconds represent a time today,
# in the current time zone
use Time::Local;
$time = timelocal($seconds, $minutes, $hours, (localtime)[3,4,5]);
#-----------------------------
# $day is day in month (1-31)
# $month is month in year (1-12)
# $year is four-digit year e.g., 1967
# $hours, $minutes and $seconds represent UTC time
use Time::Local;
$time = timegm($seconds, $minutes, $hours, $day, $month-1, $year-1900);
#-----------------------------
</CODE>
This also gives me the same error.
Is their something I need to update in my perl installation to get this module to work properly?
thanks
What values are you feeding the routines? For your example (2009-02-25 23:57:22) they should be...
$TIME = timelocal(22, 57, 23, 25, 3, 109);