Quickmarch
2009-11-19 05:32:01
There's an bug in TheDate so that it adds an extra number.
Fix:
Fix:
function TheDate(DateFormat: Integer): string;
var
Year, Month, Day: Word;
M, D: string;
Mnths, sfx: TStringArray;
begin
DecodeDate(Date, Year, Month, Day);
Mnths := ['January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December'];
sfx := ['st', 'nd', 'rd', 'th'];
case DateFormat of
1:
begin
m := Mnths[Month - 1];
D := (IntToStr(Day)[Length(IntToStr(Day))]);
if StrInArr(D, ['1', '2', '3']) then
D := sfx[Max(StrToInt(D), 4) - 1];
Result := M + ' ' + IntToStr(Day) + {Removed something here}', ' + IntToStr(Year);
end;
2: Result := Padz(IntToStr(Month), 2) + '/' + Padz(IntToStr(Day), 2) + '/' + Copy(IntToStr(Year), 3, 4);
3: Result := Padz(IntToStr(Day), 2) + '-' + Padz(IntToStr(Month), 2) + '-' + Copy(IntToStr(Year), 3, 4);
else
srl_Warn('TheDate', 'DateFormat can only be 1, 2, or 3!', warn_AllVersions);
end;
end;