Function to obtain the date/time value of the start of the week from the specified date.

 

Syntax

function StartOfTheWeek(dt: double): double;

 

Parameters and return values

Parameter

Type

Value

dt

double

source date/time value.

 

Function result

Date/time value of the start of the week (Monday by default).

 

Example

var
  dt, dtNow: double;
begin
  dtNow := Now;
  dt := StartOfTheWeek(dtNow);
  mLogScript(FormatDateTime('mm.dd.yyyy hh:nn:ss', dtNow), 'Now');
  mLogScript(FormatDateTime('mm.dd.yyyy hh:nn:ss', dt), 'StartOfTheWeek');
end.

Script work result

[20:08:47] (Log "StartOfTheWeek"): [Now] 12.12.2016 20:08:47

[20:08:47] (Log "StartOfTheWeek"): [StartOfTheWeek] 12.12.2016 00:00:00

[20:08:47] (Run "StartOfTheWeek"): Script operation time: 5 ms

[20:08:47] (Run "StartOfTheWeek"): Script done successfully.

 

See also

FormatDateTime

mLogScript

Now