MyChat Scripts Engine: DayOfTheWeek
Function to obtain the day of the week from the specified date.
Syntax
function DayOfTheWeek(dt: double): integer;
Parameters and return values
Parameter |
Type |
Value |
dt |
double |
date value, the day of the week that you want to determine. |
Function result
Day of the week, value from 1 through 7. Numeration starts from Monday.
Example
var
dt: double;
n: integer;
s: string;
begin
dt := Now;
mLogScript(FormatDateTime('mm.dd.yyyy hh:nn:ss', dt), 'now');
n := DayOfTheWeek(dt);
case n of
1 : s := 'Monday';
2 : s := 'Tuesday';
3 : s := 'Wednesday';
4 : s := 'Thursday';
5 : s := 'Friday';
6 : s := 'Saturday';
7 : s := 'Sunday';
end;
mLogScript('Today is: ' + s, '');
end.
Script work result
[16:28:40] (Log "DayOfTheWeek"): [now] 07.01.2016 16:28:40
[16:28:40] (Log "DayOfTheWeek"): Today is: Friday