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

獲取當(dāng)前時(shí)間信息

Original 2019-03-27 11:25:05 272
abstract:<!DOCTYPE html> <html> <head>     <meta charset="utf-8"> <title>獲取當(dāng)前時(shí)間信息</title> </head> <body> <script 
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<title>獲取當(dāng)前時(shí)間信息</title>
</head>
<body>
<script type="text/javascript">
  //獲取當(dāng)前時(shí)間
  var myday = new Date();
  // document.write(myday);
  // Wed   Mar  27 2019   10:29:43 GMT+0800 (中國(guó)標(biāo)準(zhǔn)時(shí)間)
  // 星期 月份  日  年份  時(shí)間
  //獲取年份 getFullYear()  前提是要先獲取時(shí)間
  document.write('現(xiàn)在是'+myday.getFullYear()+'年');
  //獲取月份  getMonth()   0代表是1
 
  // document.write(myday.getMonth()+'月'+'<br>');
  var month = new Array(12);
      month[0] = '1月'
      month[1] = '2月'
      month[2] = '3月'
      month[3] = '4月'
      month[4] = '5月'
      month[5] = '6月'
      month[6] = '7月'
      month[7] = '8月'
      month[8] = '9月'
      month[9] = '10月'
      month[10] = '11月'
      month[11] = '12月'
      document.write(month[myday.getMonth()]);
    
       // 獲取日期  getDate()返回值是0~31之間的整數(shù)
     document.write(myday.getDate()+'日'); 
     // 獲取星期 getDay() 0代表的是周日  6代表的是周六  (返回值是0~6之間的一個(gè)整數(shù))
     // document.write(myday.getDay());
    var day = new Array(7);
        day[0] = '星期天'
        day[1] = '星期一'
        day[2] = '星期二'
        day[3] = '星期三'
        day[4] = '星期四'
        day[5] = '星期五'
        day[6] = '星期六'
    
      document.write(day[myday.getDay()]);
   //獲取小時(shí) getHours() 0~23
   document.write(myday.getHours()+'時(shí)');
   // 獲取分鐘 getMinutes()  0~59
   document.write(myday.getMinutes()+'分');
   //獲取秒針 getSeconds() 0~59
   document.write(myday.getSeconds()+'秒');
</script>
</body>
</html>


Correcting teacher:天蓬老師Correction time:2019-03-27 13:15:54
Teacher's summary:Date 是JavaScript內(nèi)置的對(duì)象之一, 很多功能和特效,都要依賴它才可以完成, 好好學(xué)

Release Notes

Popular Entries