DayName2DOW Function
Given a Day Name this routines searches through the Short and then Long Day Names supplied in the Registry to do a Left Match, and then return the Day Number.

Unit
QESBPCSDateTime

Declaration
Function DayName2DOW(const DayName: string): Byte;

Description
So for English Names, 'T' would return 3 for 'Tuesday'.

Parameters
DayName Name of the Day of Week to search for.

Returns
the DOW Number, 1 through 7 - 0 implies not found. 1 is Sunday.

Category
Date/Time Conversion Routines

Implementation

function DayName2DOW (const DayName: string): Byte;
var
     I: Integer;
     Len: Integer;
     DN: string;
begin
     Result := 0;
     if DayName = '' then
          Exit;
     Len := Length (DayName);
     DN := AnsiUpperCase (DayName);
     for I := 1 to 7 do
     begin
          if AnsiUpperCase (LeftStr (ShortDayNames [I], Len)) = DN then
          begin
               Result := I;
               Exit;
          end;
     end;
     for I := 1 to 7 do
     begin
          if AnsiUpperCase (LeftStr (LongDayNames [I], Len)) = DN then
          begin
               Result := I;
               Exit;
          end;
     end;
End;


HTML generated by Time2HELP
http://www.time2help.com