<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <span id="a"> </body> </html> <script> function b(){ var a=document.getElementById("a") var time=new Date() var year=time.getFullYear() var month=time.getMonth()+1 var day=time.getDay() var hour=time.getHours() var min=time.getMinutes()<10?"0"+time.getMinutes():time.getMinutes() var sec=time.getSeconds()<10?"0"+time.getSeconds():time.getSeconds() var get_time=year+"/"+month+"/"+day+"  "+hour+":"+min+":"+sec a.innerHTML=get_time } window.setInterval("b()",500) </script>