| MonthName2Month Function |
Unit
QESBPCSDateTime
Declaration
Function MonthName2Month(const MonthName: string): Word;
Description
So for English Names, 'Ma' would return 3 for 'March' .
| Parameters |
| MonthName | Name of the Month to search for. |
Returns
the Month Number, 1 through 12 - 0 implies not found.
Category
Date/Time Conversion Routines
Month Based Arithmetic RoutinesImplementation
function MonthName2Month (const MonthName: string): Word;
var
I: Integer;
Len: Integer;
MN: string;
begin
Result := 0;
if MonthName = '' then
Exit;
Len := Length (MonthName);
MN := AnsiUpperCase (MonthName);
for I := 1 to 12 do
begin
if AnsiUpperCase (LeftStr (ShortMonthNames [I], Len)) = MN then
begin
Result := I;
Exit;
end;
end;
for I := 1 to 12 do
begin
if AnsiUpperCase (LeftStr (LongMonthNames [I], Len)) = MN then
begin
Result := I;
Exit;
end;
end;
End; |
|
|