<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript"> var date; date = new Date();//创建一个日期对象 date = date.toLocaleString();//将日期置换为本地格式 alert(date); </script> </head> <body> </body> </html>