时间日期代码

时间:2022-10-24 17:28:16 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

<script language="JavaScript" type="text/JavaScript">

var day="";

var month="";

var ampm="";

var ampmhour="";

var myweekday="";

var year="";

mydate=new Date();

myweekday=mydate.getDay();

mymonth=mydate.getMonth()+1;

myday= mydate.getDate();

myyear= mydate.getYear();

myhour = mydate.getHours();

myminu = mydate.getMinutes();

mysec = mydate.getSeconds();

year=(myyear > 200) ? myyear : 1900 + myyear;

if(myweekday == 0)

weekday=" 星期日 ";

else if(myweekday == 1)

weekday=" 星期一 ";

else if(myweekday == 2)

weekday=" 星期二 ";

else if(myweekday == 3)

weekday=" 星期三 ";

else if(myweekday == 4)

weekday=" 星期四 ";

else if(myweekday == 5)

weekday=" 星期五 ";

else if(myweekday == 6)

weekday=" 星期六 ";

document.write(year+"年"+mymonth+"月"+myday+"日 "+weekday+myhour+":"+myminu+":"+mysec+"<br />");

</script>

本文来源:https://www.wddqw.com/doc/bd85502d453610661ed9f4ae.html