Ow Mun Heng wrote:
Been struggling with a new script I'm porting over from bash because
perl's DBI is much more elegant than my previous usage of sqsh.
I'm having trouble converting from a datetime into a unix epoch
timestamp.
under bash, this is done.
date = YYYY-MM-DD HH:MM:SS
epoch_date = date -d "$date" +%s
$date
Mon Aug 13 14:39:48 MYT 2007
$date -d "2007-08-13 14:39:48" +%s
1186987188
Under perl, I have no idea how this can be achieved.
Neither localtime, timelocal or AFAICT, DateTime can achieve this
easily.
The DateManip module may have what you need. From its description:
"This is a set of routines designed to make any common date/time
manipulation easy to do...From the very beginning, the main focus of
Date::Manip has been to be able to do ANY desired date/time operation
easily"
See http://search.cpan.org/~sbeck/DateManip-5.44/Manip.pod or do an
'emerge -av DateManip'
--
[EMAIL PROTECTED] mailing list