摘要:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>Date日期對象</title></head><body><script type="text/javascript">// 日期對象是
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Date日期對象</title>
</head>
<body>
<script type="text/javascript">
// 日期對象是用以處理日期和時間的
// 獲取當前時間
var myday=new Date()
document.write(myday+"<br>")
//獲取年份 getFullYear()
document.write(myday.getFullYear()+"年")
//獲取月份 getMonth
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[myday.getMonth()])
//獲取某一天 getDate
document.write(myday.getDate()+"日")
//獲取小時 getHours
document.write(myday.getHours()+"時")
//獲取幾分 getMinutes
document.write(myday.getMinutes()+"分")
//獲取秒 getSeconds
document.write(myday.getSeconds()+"秒")
//獲取星期幾 getday()
document.write("星期"+myday.getDay())
</script>
</body>
</html>
批改老師:韋小寶批改時間:2019-01-25 17:49:29
老師總結(jié):看到你這作業(yè)名,嚇了我一跳,Java和JavaScript是完全不相同的兩個語言哦 作業(yè)寫的很不錯 繼續(xù)加油吧