How is output "0" before 0,1,2,3...9 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
18th Sep 2020, 8:04 PM
Тимур Завьялов
Тимур Завьялов - avatar
6 Answers
18th Sep 2020, 8:14 PM
Russ
Russ - avatar
+ 1
it's showing me right time ,not sure what you are talking about
18th Sep 2020, 8:15 PM
Abhay
Abhay - avatar
+ 1
If your intention is only to show the current time then I think the following would suffice: document.write(minutes.toString().padStart(2, "0"))
18th Sep 2020, 8:38 PM
Joseph Sambo II
Joseph Sambo II - avatar
0
Abhay, when the time shows 23:05, JavaScript is output 25:5
18th Sep 2020, 8:26 PM
Тимур Завьялов
Тимур Завьялов - avatar
0
How to do that JavaScript is output 23:05 instead of 23:5
18th Sep 2020, 8:27 PM
Тимур Завьялов
Тимур Завьялов - avatar
0
If (hours<10){ hours = "0"+hours ; } similarily for minutes
19th Sep 2020, 5:21 AM
Divya Mohan
Divya Mohan - avatar