setSeconds function

Sets the seconds for a specified date object, according to local time.
Arguments
1–2, Optional arguments are indicated by a ? following the argument name.
Argument Description
sec An integer representing the seconds.

0–59 are the expected values, but -1 or 60 can also be used.

millisec? An integer representing the milliseconds.

0–999 are the expected values, but -1 or 1000 can also be used.

Return value (number)
A number representing the number of milliseconds between the date object and midnight January 1 1970.
  • If sec is -1, returns the last second of the previous minute.
  • If sec is 60, returns the first second of the next minute.
  • If millisec? is -1, returns the last millisecond of the previous second.
  • If millisec? is 1000, returns the first millisecond of the next second.
Syntax
dateObj.setSeconds(sec, millisec?)
Examples
Example Result
This script is added, as a custom script on an action, to any element with a Label property, such as a button.
var d = new Date(); 
d.setSeconds(49); 
this.Label = d.getSeconds();
Returns 49 on the element's label.