JavaScript setSeconds()

The JavaScript date setSeconds() method sets the second value for the particular date on the basis of local time.

Syntax:

dateObj.setSeconds(new_seconds);

Parameters:
new_seconds: Integer value between 0 to 59.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var bday =new Date("November 16, 1994 21:00:50");
document.writeln(bday.getSeconds() + "<br>");
bday.setSeconds(45);
document.writeln(bday.getSeconds());
</script>
</body>
</html>