print JulianDate$("today") ' not case sensitive
print JulianDate$("")
print JulianDate$("08/25/14")
print JulianDate$("1/1/14") ' single digit month and day is ok
print JulianDate$("12 31 14") ' any separator is ok
print JulianDate$("12/31/12")
print JulianDate$("12/31/2000")
print JulianDate$("12/31/1900")
print JulianDate$("08-25-75") ' two digit year is the current (21st) century
print JulianDate$("08/25/1975") ' four digit year can be any century
print JulianDate$("august 25, 1975")
print JulianDate$("08/35/14") ' day error
print JulianDate$("13/25/14") ' month error
function JulianDate$(DateString$)
JulianDate$="0000-000"
if lower$(DateString$)="today" or DateString$="" then
ObjectDays=date$("days")
ObjectDate$=date$()
else
ObjectDays=date$(DateString$)
if ObjectDays=0 then exit function
ObjectDate$=DateString$
end if
ObjectYear$=right$(ObjectDate$,4)
if val(left$(ObjectYear$,2))<9 then
ObjectYear$=right$(ObjectYear$,2)
ObjectCentury$="20"
ObjectYear$=ObjectCentury$+ObjectYear$
end if
ObjectYear=val(ObjectYear$)
EndPriorYear$="12/31/"+str$(ObjectYear-1)
StartYearDays=date$(EndPriorYear$)
ObjectOrdinal$=using("###", ObjectDays-StartYearDays)
if val(ObjectOrdinal$)>366 then exit function
for x=1 to len(ObjectOrdinal$)-1
if mid$(ObjectOrdinal$,x,1)=" " then mid$(ObjectOrdinal$,x,1)="0"
next x
JulianDate$=ObjectYear$+"-"+ObjectOrdinal$
end function