How to get seconds from Current (Today) Date Time in JavaScript.
Example: second value is 50.
Hi makenzi.exc,
Use getSeconds method of Date object.
Refer below example.
HTML
<html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> body { font-family: Arial; font-size: 10pt; } </style> </head> <body> <input type="button" value="Get Seconds" onclick="GetSeconds()" /> <script type="text/javascript"> function GetSeconds() { //Current Date object. var dt = new Date(); // Get Seconds. var seconds = dt.getSeconds(); alert("Second is: " + seconds); } </script> </body> </html>
Demo
Screenshot
Downloads
Download Sample
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.