Todd W wrote:

> [trwww@devel_rh trwww]$ perl
> use Time::Local;
> ($day, $month, $year) = ( localtime() )[3 .. 5];
> 
> $epoch = timelocal( 0, 0, 0, $day, $month, $year );
> 
> print( scalar( localtime( $epoch ) ), "\n" );
> Ctrl-D
> Fri Jan 10 00:00:00 2003
> 
> $epoch holds the seconds between the epoch and today at midight.


i found the following slightly clearer:

[dzhuo@panda]$ perl -MDate::Manip
print UnixDate(ParseDate('midnight'),'%s'),"\n";
Ctrl-D
1042444800

Date::Manip came with my 5.8. Date::Manip is big and can be slow so you 
really need to perldoc Date::Manip to see if you want to use it for such a 
simple task.

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to