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 )

Subscribe to our mailing list

* indicates required
Subscribe to plus2net
Your Rating


Google+

More on JavaScript Date & Time

Post Comment This is for short comments only. Use the forum for more discussions.




Subscribe to our mailing list

* indicates required
Subscribe to plus2net
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2018 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer