CodesJava

Easy learning with example program codes

JavaScript JS Date getSeconds() method


The JavaScript date getSeconds() method is used to get the integer value between 0 and 60 that represents the seconds based on the local time.

Syntax:

dateObj.getSeconds()
Example:

<!DOCTYPE html>
<html>
<body>
 
<script>
var d = new Date("March 16, 2018 13:34:45:500");
  var n = d.getSeconds();
  document.writeln(n) 
</script>
 
</body>
</html>

Output:

45
Please follow and like us:


Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki