Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/bin/ksh
#-----------------------------------------------------------------------------
# Date manipulation routines - convering to Julian and back
#
# Julian Day Number from calendar date
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 ))
}
# Calendar date from Julian Day Number
julian2date() # julianday
{
#set -x
typeset tmpday=$(($1 - 1721119))
typeset centuries=$(( (4 * tmpday - 1) / 146097))
tmpday=$((tmpday + centuries - centuries/4))
typeset year=$(( (4 * tmpday - 1) / 1461))
tmpday=$((tmpday - (1461 * year) / 4))
typeset month=$(( (10 * tmpday - 5) / 306))
day=$((tmpday - (306 * month + 5) / 10))
month=$((month + 2))
year=$((year + month/12))
month=$((month % 12 + 1))
printf "%s %02d %02d" $year $month $day
}
# Day of week, Monday=1...Sunday=7
dow() # year month day
{
print $(( $(date2julian $1 $2 $3) % 7 + 1))
}