---
url: >-
  /statelake/scripting-reference/functions-and-procedures/datetime-functions/secondoftheday.md
---

# SecondOfTheDay

The **SecondOfTheDay** function returns the number of seconds from the specified **TDateTime** value **AValue**, and 12:00 A.M. of the same day.

**Declaration**: Function SecondOfTheDay( const AValue : TDateTime) : Cardinal;

An example of its use.

```pascal
procedure ScriptEvent (var Value : variant);
var
  TheSec : cardinal;
begin
 //The number of seconds so far today ....
  TheSec := SecondOfTheDay(Now);
  LogInfo('Number of seconds is ....' + InToStr(TheSec);
  LogInfo('');
end;
```
