[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Command-line-interface (CLI) calculator to work out the difference between 2 dates



On 08/24/08 10:07, j t wrote:
Hi all.

Does anyone have any suggestions for a command-line-interface (CLI)
calculator that can work out the difference between 2 (gregorian)
dates (i.e. that is calendar aware). My favourite cli calculator
("bc") doesn't seem to have any knowledge of the gregorian calendar.

Just to make it clear, I'd like to be able to type in:

20080824-20080724 and it would work out the answer as 31

(I'm happy to use any date format for input - I've only used ISO8601
as an example)

I think I'd write a simple Python/Perl script: convert date1 and date2 to seconds past epoch, subtract, and divide by 86400.

--
Ron Johnson, Jr.
Jefferson LA  USA

"Do not bite at the bait of pleasure till you know there is no
hook beneath it."  -- Thomas Jefferson


Reply to: