Hi there,
I have a Perl script in which I want to do this:
Take the time/ date now
Set the time/date to 00:00:00 yesterday
Convert to epoch time
This is the code I am using:
But the problem is, the month comes out as "Feb" and this seems to mess with the epoch time... Do I have to create a hash to map these values and then refer to that (i.e. Feb->01) or is there some clever thing that can do this for me?
Thanks
I have a Perl script in which I want to do this:
Take the time/ date now
Set the time/date to 00:00:00 yesterday
Convert to epoch time
This is the code I am using:
PHP:
#!/usr/bin/perl
use strict;
use Time::Local;
{
my $thing=scalar localtime time-(3600*24);
if ($thing=~m/ (\w.*) (\d?).*:\d.:\d. (2\d.*)/)
{
print timelocal(0,0,0,$2,$1,$3);
}
}
But the problem is, the month comes out as "Feb" and this seems to mess with the epoch time... Do I have to create a hash to map these values and then refer to that (i.e. Feb->01) or is there some clever thing that can do this for me?
Thanks
Last edited: