display live updating date and time in html

Solutions on MaxInterview for display live updating date and time in html by the best coders in the world

showing results for - "display live updating date and time in html"
Ana Paula
24 Feb 2020
1// date part ///
2var month=x.getMonth()+1;
3var day=x.getDate();
4var year=x.getFullYear();
5if (month <10 ){month='0' + month;}
6if (day <10 ){day='0' + day;}
7var x3= month+'-'+day+'-'+year;
8
9// time part //
10var hour=x.getHours();
11var minute=x.getMinutes();
12var second=x.getSeconds();
13if(hour <10 ){hour='0'+hour;}
14if(minute <10 ) {minute='0' + minute; }
15if(second<10){second='0' + second;}
16var x3 = x3 + ' ' +  hour+':'+minute+':'+second
17
18<span id='ct4' style="background-color:#FFFF00"></span>
19