CodesJava

Easy learning with example program codes

JavaScript setSeconds() method

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>

Output:

50
45
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status