in reply to Re: epoch time
in thread epoch time
my $time = timelocal(0, 0, 0, $d, $m-1, $y - 1900);
Also, for this particular application, why not set the hash up with the subtraction by one already done?
my %month_num_by_name = ( JAN => 0, FEB => 1, ... );
Cheers,
JohnGG
Update: davorg and ikegami have pointed out that timelocal() does accept dates like 2007 without first subtracting 1900, although it does the right thing if you do the subtraction as well. ikegami also explained his excellent reason for doing the month the way he does.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: epoch time
by davorg (Chancellor) on Jan 31, 2007 at 17:13 UTC | |
by johngg (Canon) on Jan 31, 2007 at 17:24 UTC | |
|
Re^3: epoch time
by ikegami (Patriarch) on Jan 31, 2007 at 17:26 UTC | |
by johngg (Canon) on Jan 31, 2007 at 20:17 UTC |