Article ID: 106690
Article Last Modified on 12/1/2003
* Begin program
@1,1 SAY "Enter a date" GET testdate DEFAULT { / / }
READ
@2,1 SAY "The Julian Date of "+ DTOC(testdate) + " is " ;
+ TRANSFORM(julian(testdate),'99999')
*End program
FUNCTION julian
PARAMETER tdate
*isolate the year and convert it to a string
cYear = RIGHT(DTOC(tdate),2)
firstjan = CTOD("01/01/" + cYear)
*calculate the sequential number of the day
jday = tdate-firstjan+1
*position the year at the two leftmost digits
nYear = VAL(cYear) * 1000
*combine year and day number
jdate = nYear + jday
RETURN jdate
*End Function julian
Additional query words: VFoxWin FoxDos FoxWin format
Keywords: kbcode KB106690