+ 2

Time in Javascript?

I dont know how to get the current time as a value. Can someone help or maybe reference a lesson please? I had no luck in q&a forums...

12th Jan 2019, 4:35 PM
Joshua Morgan
Joshua Morgan - avatar
3 Respuestas
+ 8
You can do it like this: var d = new Date(); d.getHours() //get hour in 24 hr format d.getMinutes() //get minutes Here are some websites that you can visit: (1) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date (2) https://www.w3schools.com/js/js_dates.asp (3) https://www.tutorialspoint.com/javascript/javascript_date_object.htm
12th Jan 2019, 5:08 PM
VEDANG
VEDANG - avatar
+ 4
https://www.w3schools.com/js/js_date_methods.asp
12th Jan 2019, 5:04 PM
Seniru
Seniru - avatar
+ 3
You can get the current time by creating instance of Date() object you can access hours, seconds, minutes as explained in the sololearn js course.
12th Jan 2019, 8:36 PM
Adarsh.n. Bidari
Adarsh.n. Bidari - avatar