javascript日期

原创2019-03-18 17:07:5696
摘要:<!doctype html><html><head><meta charset="utf-8"><title>javascript日期</title></head><body><script type="text/javascript">var my

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>javascript日期</title>

</head>

<body>

<script type="text/javascript">

var myday=new Date()

//document.write(myday)

document.write(myday.getFullYear()+"年" )

var month=new Array(12)

   month[0]="01月"

   month[1]="02月"

   month[2]="03月"

   month[3]="04月"

   month[4]="05月"

   month[5]="06月"

   month[6]="07月"

   month[7]="08月"

   month[8]="09月"

   month[9]="10月"

   month[10]="11月"

   month[11]="12月"

document.write(month[myday.getMonth()])

document.write(myday.getDate()+"日" )

document.write(myday.getHours()+"点" )

document.write(myday.getMinutes()+"分" )

document.write(myday.getSeconds()+"秒" )

</script>

</body>

</html>

批改老师:灭绝师太批改时间:2019-03-19 09:21:07
老师总结:完成的不错,注意月份和星期是从0开始的哦!

发布手记

热门词条