Javascript GetSeconds() Function

The getSeconds() method of date object returns seconds of the specified date. Use it for example to get seconds of the specified date.

Syntax

dateObj.getSeconds()

Javascript GetSeconds() Function Example

<html>
<head>
<script type="text/javascript">
//Creating date object
var my_date0=new Date();  
var my_date1=new Date("August 15, 1947 13:14:00");  
var my_date2=new Date("August 15, 1947");  
var my_date3=new Date(88,09,12,13,14,00); 
var my_date4=new Date("12/12/2014");  

document.write(my_date0.getSeconds() + "</br>");
document.write(my_date1.getSeconds() + "</br>");
document.write(my_date2.getSeconds() + "</br>");
document.write(my_date3.getSeconds() + "</br>");
document.write(my_date4.getSeconds() + "</br>");
</script>
</head>
<body>
</body>
</html>

This will produce following result

10
0
0
0
0