Convert a Date to a Long Julian Date





5
Date Submitted Fri. Oct. 27th, 2006 9:33 AM
Revision 1 of 1
Helper bright
Tags Date | Delphi | Julian
Comments 0 comments
This function will convert a Date (passed as type TDateTime) to a long-format Julian calendar date (result as type String).


function DateToLongJulian(Date: TDateTime): String;
var
  Year, Month, Day: Word;
  FirstDay, Today: Longint;
begin
  DecodeDate(Date, Year, Month, Day);
  FirstDay := DateToAbsolute(EncodeDate(Year, 1, 1));
  Today := DateToAbsolute(Date);

  Result := FormatDateTime('yyyy', Date) + FormatFloat('000', Today - FirstDay + 1);
end;

 

Comments

There are currently no comments for this snippet.

Voting

Votes Down