How to get time form the datetime in jquery
Suppose,
datetime = Wed Mar 06 2013 11:30:00 GMT+0530 (IST)
I need only 11:30:00 from this such that
time = 11:30:00
check out the W3C Javascript Datetime Object Reference:
var hours = datetime.getHours(); //returns 0-23
var minutes = datetime.getMinutes(); //returns 0-59
var seconds = datetime.getSeconds(); //returns 0-59
your question:
if(minutes<10)
minutesString = 0+minutes+""; //+""casts minutes to a string.
else
minutesString = minutes;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With