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

 

Syntax

function StartOfTheYear(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 year.

 

Example

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

Script work result

[19:33:14] (Log "StartOfTheYear"): [Now] 12.12.2016 19:33:14

[19:33:14] (Log "StartOfTheYear"): [StartOfTheYear] 01.01.2016 00:00:00

[19:33:14] (Run "StartOfTheYear"): Script operation time: 5 ms

[19:33:14] (Run "StartOfTheYear"): Script done successfully.

 

See also

FormatDateTime

mLogScript

Now