+ 2
HOW DO I DISPLAY THE TIME??
I wrote this code but i dont know how to display the time in my output. Can anyone help? Here is the code in javascript function printTime() { var d = new Date(); var hour = d.getHours(); var mins = d.getMinutes(); var secs = d.getSeconds(); var year = d.getFullYear(); var month = d.getMonths(); var date = d.getDate(); var format = "<small> AM </small>"; format = (hours > 11)? "<small> PM </small>" format; if (hour > 12) { hour = hour - 12 ; } }
4 Answers
+ 3
Something like that?
https://code.sololearn.com/WOELp23kQDFN/?ref=app
+ 1
I need to write it on the webpage body
0
on webpage body or console log?
0
if you need to display it on a web page you have to write the appropriate HTML code....
if you need to display it on the console, just console.log() it