How do I change a Julian date to a Gregorian date and remain Y2K compliant?
I am not sure how the year is stored in the Julian date, so I will suppose that it is at the beginning of the Julian string for the sake of this solution. I will also assume that the Julian date is stored as a character value.
Let's assume there is a Julian date 1999003, which would be Jan 3, 1999. Create a PRG file with the following code in it:
LOCAL lnJulianNumber, ldReturnValue
lcJulianYear = LEFTC(tcJulianDate,4)
lcJulianDay = RIGHTC(tcJulianDate,3)
lnJulianDay = VAL(lcJulianDay)
*-- Create a date that is Jan 1st of Julian year
ldReturnValue = CTOD("01/01/"+lcJulianYear)
*-- Add the numeric Julian date and subtract
*-- one because Jan 1 = 1, not zero
ldReturnValue = ldReturnValue + lnJulianDay - 1