时间日期代码

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.wddqxz.cn/bd85502d453610661ed9f4ae.html

相关推荐