Re: Command-line-interface (CLI) calculator to work out the difference between 2 dates
On 2008-08-24 11:13:43 -0500, Ron Johnson wrote:
> I think I'd write a simple Python/Perl script: convert date1 and date2 to
> seconds past epoch, subtract, and divide by 86400.
In Perl, you can also use the Date::Manip module:
4. The amount of time between two dates.
$date1 = ParseDate($string1);
$date2 = ParseDate($string2);
$delta = DateCalc($date1,$date2,\$err);
=> 0:0:WK:DD:HH:MM:SS the weeks, days, hours, minutes,
and seconds between the two
$delta = DateCalc($date1,$date2,\$err,1);
=> YY:MM:WK:DD:HH:MM:SS the years, months, etc. between
the two
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
Reply to: