+ 1

How to insert current time in html using javascript?

HTML css js

3rd Oct 2017, 8:47 AM
mithilesh pradhan
mithilesh pradhan - avatar
2 Answers
+ 1
Date.prototype.timeNow = function () { return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes() +":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds(); } var date = new Date(); date.timeNow();
3rd Oct 2017, 9:31 AM
CalviŐČ
CalviŐČ - avatar