C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Date getSeconds() methodThe JavaScript date getSeconds() method returns the seconds in the specified date on the basis of local time. SyntaxThe getSeconds() method is represented by the following syntax: dateObj.getSeconds() ReturnAn integer value between 0 and 59 that represents the second. JavaScript Date getSeconds() method exampleHere, we will understand getSeconds() method through various examples. Example 1Let's see an example to print the value of current second. <script> var sec=new Date(); document.writeln(sec.getSeconds()); </script> Output: 56 Example 2Let's see an example to print the value of seconds from the given date. <script> var sec=new Date("August 15, 1947 20:22:10"); document.writeln(sec.getSeconds()); </script> Output: 10
Next TopicJavaScript Math
|