Javascript examples for Date:setUTCDate
Adding setUTCDate() to format Date time
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* ww w .ja v a 2s .c o m*/ function checkTime(i) { if(i<10) i='0'+i; return i; } var d = new Date(); var now = checkTime(d.getUTCHours()) + ':' + checkTime(d.getUTCMinutes()) + ':' + checkTime(d.getUTCSeconds()); console.log(now); } </script> </head> <body> </body> </html>