HTML获取当前时间

代码如下:

<SCRIPT language=JavaScript>
today = new Date();
var date;
var centry ;
centry="";
if (today.getFullYear()<2000 )
centry = "19" ;
date1 = centry + (today.getFullYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日 " ;
date2 = "";
document.write( date1+date2);
</SCRIPT>

可以把上述代码放到网页任何地方

Joker ·
评论 · 首页 订阅