Function to obtain the value of seconds of the specified minute from the date/time value.

 

Syntax

function SecondOf(dt: double): integer;

 

Parameters and return values

Parameter

Type

Value

dt

double

date/time value from which you need to obtain the numeric value of seconds of the current minute.

 

Function result

Returns the second of the minute, value from 0 through 59.

 

Example


var
  iSecond: integer;
  s: string;
  dtNow: double;
begin
  dtNow   := Now;
  iSecond := SecondOf(dtNow);
  s := inttostr(iSecond) + ' second';
  
    if iSecond > 1 then s := s + 's';
    
  s := s + ' elapsed from ' + FormatDateTime('hh:nn', dtNow) + ':00';
  
  mLogScript(s, '');
end.


Script work result

[14:55:11] (Log "SecondOf"): 11 seconds elapsed from 14:55:00


See also

IntToStr

FormatDateTime

mLogScript

Now