Re: Command-line-interface (CLI) calculator to work out the difference between 2 dates
On Sunday 24 August 2008 18.07.59 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
While I'm sure someone else will provide a much better way, I've used
something like
$ echo $(date -d 20080824 +%j) - $(date -d 20080724 +%j) | bc
31
..in the past.
Reply to: