Anyone interested?
I've created a script for date calculations,
dateadd, datediff, Julian day number conversion and formatting
Syntax: datecalc [-j] [-f <out_date_format>] <function> <args>
Dates are dates in the proleptic Gregorion Calendar
for Julian Calendar dates use -j flag
e.g. current date: 2005-10-24
How many days to new year?
datecalc datediff 2006 1 1 `date '+%Y %m %d'`
69
end of last month
datecalc -f "dddd, d mmmm yyyy (Week ww)" dateadd `date '+%Y %m'` 1 -1
Friday, 30 September 2005 (Week 39)
The last day Great Britain used the Julian calendar was 1752-09-02
wat was the julian day number and what was the next date
datecalc -j jd 1752 9 2 # Get julian day number
2361221
echo $(datecalc -f 'ddd yyyy-mm-dd' jc 2361221) was followed\
by $(datecalc -f 'ddd yyyy-mm-dd' gc 2361222)
Wed 1752-09-02 was followed by Thu 1752-09-14
How many days to drop in 1582 when Italy changed
from the Julian calendar to the Gregorian calendar
echo $(( $(datecalc -j jd 1582 10 4) - $(datecalc jd 1582 10 4) ))
10
ordinal day number in particular year (like date +%j)
datecalc od 2004 3 1
61
what is the gregorian calendar date for ordinal date 2004-60
datecalc -f "yyyy-mm-dd" gc 2004 60
2004-02-29
On what date is easter in 2010
datecalc -f "d-mmm-yyyy" easter 2010
4-Apr-2010
ISO 8601 week number (yyyy-Www-d) for 2005-01-01
datecalc isoweek 2005 1 1
2004-W53-6