Title: Date Description
Question: User needed description of date for legal document to print out like this 'on the 5th day of June in the year 2000'.
Answer:
function DateDescription(inDate : TDateTime):string;
var sDay : string;
begin
sDay := formatdatetime('d',inDate);
case strtoint(sDay) of
1: result := '1st';
2: result := '2nd';
3: result := '3rd';
21: result := '21st';
22: result := '22nd';
23: result := '23rd';
31: result := '31st';
else
result := sDay + 'th';
end;//case
end;
If the date 11/12/2000 is passed this function will return '12th'. To acheive the rest of the requirement we used format('mmmm',Date) to get the month, and format(yyyy,date) to get the year.
There are other ways to get the year and month, but this function was to get the date in that format.
Hope this helps someone out.
Ross