时间对象的学习

原创 2019-02-23 14:35:59 224
摘要:<!DOCTYPE html><html><head>    <title>Date(日期操作方法)</title></head><body><script type="text/javascript">var dd=new Date()doc

<!DOCTYPE html>

<html>

<head>

    <title>Date(日期操作方法)</title>

</head>

<body>

<script type="text/javascript">


var dd=new Date()

document.write(dd+"<br>")


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

document.write(dd.getMonth()+"月")

document.write("<br>")

var month=new Array(12)

month[0]="一月"

month[1]="二月"

month[2]="三月"

month[3]="四月"

month[4]="五月"

month[5]="六月"

month[6]="七月"

month[7]="八月"

month[8]="九月"

month[9]="十月"

month[10]="十一月"

month[11]="十二月"

document.write("这个月是"+month[dd.getMonth()])

 

document.write("今天是星期"+dd.getDay())

 

document.write("今天是这个月的第"+dd.getDate()+'天')

document.write("<br>")

document.write("现在是"+dd.getHours()+"时")

 

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


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


</script>

</body>

</html>


批改老师:天蓬老师批改时间:2019-02-23 14:51:00
老师总结:document.write(dd.getMinutes()+"分") document.write(dd.getSeconds()+"秒") 以后用console.log()

发布手记

热门词条