ScriptCore3.DayOfWeek

From Soldat Community Wiki
Jump to: navigation, search
 function DayOfWeek(const DateTime: TDateTime): Word;
 DateTime: Source date
 Result: Number of the day of the week

Description

This function will return number representing day of the week, from 1-7 range.

Example

var
  curr: TDateTime;
  currweekday: string;

begin
  curr := Date();
  case DayOfWeek(curr) of
   1: currweekday := 'Monday';
   2: currweekday := 'Tuesday';
   3: currweekday := 'Wednesday';
   4: currweekday := 'Thursday';
   5: currweekday := 'Friday';
   6: currweekday := 'Saturday';
   7: currweekday := 'Sunday';
  end;
  
  WriteLn('Today is '+currweekday+' '+FormatDateTime('c',Now()));
end.