I'm using Delphi BDS2006 how can I format the date (01/10/2011) to look something like
1st Oct 2011
I tried using the
ShowMessage(FormatDateTime('ddd mmm yyyy', now));
the message I get is Sat Oct 2011
ddd
gives me Sat
and not 1st
Similar way I want to add st,nd,rd,th
to the Dates
Is there a built in procedure or function to do this or I have to manually check for the date and assign the suffix to it
I'm currently using this
case dayof(now)mod 10 of
1 : days:=inttostr(dayof(dob))+'st';
2 : days:=inttostr(dayof(dob))+'nd';
3 : days:=inttostr(dayof(dob))+'rd';
else days:=inttostr(dayof(dob))+'th';
end;
There's nothing built in to Delphi to do that form of day. You will have to do it yourself. Like this: