getSeconds to collect Seconds

We can collect second from the date and time like this. Here is an example
var dt= new Date();
document.write(dt.getSeconds());
Here is the second part of your ( client ) computer date and time

We can also take Seconds part from any date variable.
var dt= new Date("Aug 15, 2013 13:52:45");
document.write(dt.getSeconds());
Output is here

Showing changing Seconds value

Here we are displaying the seconds value when the page loads. This value does not change on real time. So we will execute the code in every seconds to display the real changing seconds value. To execute the code repeatedly we will use setTimeout function which triggers in every 1000 mille seconds ( 1 second )

DEMO of changing seconds value
Getting Minutes part from date object
Date Reference
Subscribe to our YouTube Channel here



plus2net.com










We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer