getHours() to read hour from data and time

We can get hour part of the date object by using getHours function in JavaScript, Here is an example.
var dt= new Date();
document.write(dt.getHours());
Here is the output based on your time zone and date and time of your ( client ) computer

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

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