Quote:
|
Originally Posted by jazevedo
How do I figured out what the julian date is of a date?
|
here's a simple script [date2julian] for those of us who have julian-challenged 'date':
$ julian2date 09 27 2005
1727082
Code:
#!/bin/ksh
date2julian() # day month year
{
typeset year=$1; typeset month=$2; typeset day=$3
tmpmonth=$((12 * year + month - 3))
tmpyear=$((tmpmonth / 12))
print $(( (734 * tmpmonth + 15) / 24 - 2 * tmpyear + \
tmpyear/4 - tmpyear/100 + tmpyear/400 + day + 1721119 ))
}
date2julian "$1" "$2" "$3"