<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Time</title> </head> <body> <script type="text/javascript"> var d=new Date(); var year=d.getFullYear(); var month=change(d.getMonth()+1); var day=change(d.getDate()); var hour=change(d.getHours()); var minute=change(d.getMinutes()); var second=change(d.getSeconds()); function change(t){ if(t<10){ return "0"+t; }else{ return t; } } var time=year+‘-‘+month+‘-‘+day+‘ ‘+hour+‘:‘+minute+‘:‘+second; document.write(time); </script> </body> </html>
时间: 2024-11-01 00:51:25