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

 

Syntax

function StartOfTheMonth(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 month.

 

Example

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

Script work result

[19:36:56] (Log "StartOfTheMonth"): [Now] 12.12.2016 19:36:56

[19:36:56] (Log "StartOfTheMonth"): [StartOfTheMonth] 01.12.2016 00:00:00

[19:36:56] (Run "StartOfTheMonth"): Script operation time: 5 ms

[19:36:56] (Run "StartOfTheMonth"): Script done successfully.

 

See also

FormatDateTime

mLogScript

Now