I was wondering if I could give the current time a varible and how to do it. HTML. It most likely uses a var statement but I don't know how to actually get the current time.
Asked
Active
Viewed 119 times
-6
-
1– akmsharma Jan 12 '16 at 14:18
3 Answers
1
The simplest thing! If you google for 3 seconds you can get tons of articles.
var currentTime = new Date();

Marcos Pérez Gude
- 21,869
- 4
- 38
- 69
-
Thanks, I'm not good at googling and I always get the wrong stuff. Thanks for the help! – Ryan King Jan 12 '16 at 14:22
0
Something like this?
var dt = new Date();
var time = dt.getHours()+" : "+dt.getMinutes()
//Append current hours and minutes together. Append dt.getSeconds() to get current time upto the second.

gothical
- 373
- 1
- 7