C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Date getUTCSeconds() methodThe JavaScript date getUTCSeconds() method returns the seconds for the specified date on the basis of universal time. SyntaxThe getUTCSeconds() method is represented by the following syntax: dateObj.getUTCSeconds() ReturnAn integer value between 0 and 59 that represents the second. JavaScript Date getUTCSeconds() method exampleHere, we will understand getUTCSeconds() method through various examples. Example 1Let's see an example to print the value of current second according to universal time. <script> var sec=new Date(); document.writeln("Seconds Value : "+sec.getUTCSeconds()); </script> Output: Seconds Value : 51 Example 2Let's see an example to print the value of seconds from the given date according to universal time. <script> var sec1=new Date("August 15 1975 22:59:30 GMT+7:00"); var sec2=new Date("August 15 1975 22:59:50 GMT+5:30"); document.writeln("Second value1 : "+sec1.getUTCSeconds()+"<br>"); document.writeln("Second value2 : "+sec2.getUTCSeconds()); </script> Output: Second value1 : 30 Second value2 : 50
Next TopicJavaScript Date
|