{ Function to convert a TDateTime to a Military-style Julian date, i.e. 9027, 99027, or 1999027 } FUNCTION MakeAJDate(ThisDate : TDateTime;Digits :integer) : string; VAR TempDate, Days : string; RawDays : integer; LastYear : TDateTime; ResultString : string; Begin TempDate := FormatDateTime('yyyy',ThisDate); LastYear := StrToDate('12/31/'+IntToStr(StrToInt(TempDate)-1)); RawDays := Trunc(ThisDate-LastYear); FmtStr(Days,'%.3d',[RawDays]); CASE Digits OF 4 : ResultString := Copy(TempDate,4,1)+Days; {4 : 9027 } 5 : ResultString := Copy(TempDate,3,2)+Days; {5 : 99027 } ELSE ResultString := Copy(TempDate,1,4)+Days; {6 : 1999027 } END; Result := ResultString End;