亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

3.3 javaScript中 獲取日期對(duì)象:

オリジナル 2019-01-01 15:37:48 262
サマリー:3.3 javaScript中 獲取日期對(duì)象:日期對(duì)象是用以處理日期和時(shí)間的(全部都是駝峰寫法!!!)必須先獲取時(shí)間才可以獲取年月日時(shí)分秒!!! 獲取當(dāng)前時(shí)間 Date() :var myday=new Date()  //創(chuàng)建時(shí)間對(duì)象 獲取年份 getFullYear() :document.write(myday.getFullYear()+"年") 獲取月

3.3 javaScript中 獲取日期對(duì)象:日期對(duì)象是用以處理日期和時(shí)間的

(全部都是駝峰寫法?。。。┍仨毾全@取時(shí)間才可以獲取年月日時(shí)分秒?。?!

獲取當(dāng)前時(shí)間 Date() :var myday=new Date()  //創(chuàng)建時(shí)間對(duì)象

獲取年份 getFullYear() :document.write(myday.getFullYear()+"年")

獲取月份 getMonth() 0代表的是1月,11代表的是12月:document.write(myday.getMonth()+"月") 可以利用數(shù)組來正常顯示月份!

獲取星期 getDay() 0代表的是周日,6代表是周六(返回值是0~6之間的一個(gè)整數(shù)):document.write("今天是星期"+myday.getDay())

獲取日期 getDate() (返回值是0~31之間的一個(gè)整數(shù)):document.write("今天是這個(gè)月的第"+myday.getDate()+'天')

獲取小時(shí) getHours() (返回值是0~23之間的一個(gè)整數(shù)):document.write("現(xiàn)在是"+myday.getHours()+"時(shí)")

獲取分鐘 getMinutes() (返回值是0~59之間的一個(gè)整數(shù)):document.write(myday.getMinutes()+"分")

獲取秒鐘 getSeconds() (返回值是0~59之間的一個(gè)整數(shù)):獲取秒鐘 getSeconds()(返回值是0~59之間的一個(gè)整數(shù))

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>獲取當(dāng)前時(shí)間</title>
<script>
function day(){
var myday=new Date()
document.write(myday.getFullYear()+"年")
document.write(myday.getMonth()+1+"月")
document.write(myday.getDate()+"日")
document.write(myday.getHours()+"時(shí)")
document.write(myday.getMinutes()+"分")
document.write(myday.getSeconds()+"秒")
}
</script>
</head>
<body>
<button onclick="day()">獲取當(dāng)前時(shí)間</button>
</body>
</html>


添削の先生:天蓬老師添削時(shí)間:2019-01-01 18:24:23
先生のまとめ:Date()?中有非常多的方法,可以對(duì)時(shí)間和日期進(jìn)行處理, 要注意中英文之間的習(xí)慣

手記を発表する

人気のある見出し語