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

JS-日期對象(Date) 學(xué)習(xí)總結(jié)

??? 2018-11-24 23:52:38 269
????:<!DOCTYPE html> <html> <head>   <meta charset="UTF-8">   <meta name="viewport" content="width=device-width,&
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script type="text/javascript">
    var myday = new Date();
    // 由于國外的計時是從0開始的所以系統(tǒng)的11月是代表是12月!
    //"."的意思是將兩個函數(shù)進(jìn)行連接
    //myday 是獲取當(dāng)前的系統(tǒng)時間
    //month 是構(gòu)造一個數(shù)組,解決國外時間規(guī)則與國內(nèi)時間相差一個小時的問題
    // document.write( myday);//獲取當(dāng)前的時間
    // document.write(myday.getFullYear()+"年");//獲取年份一定要先調(diào)用了new Date獲取到當(dāng)前時間才能獲取到年份
    // document.write(myday.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()]);//輸出數(shù)組中判斷當(dāng)前的月份,如不使用數(shù)組來獲取當(dāng)前的月份則無輸出的月份比實際會少一個月
       document.write("<br>");
       document.write("今天是星期"+myday.getDay());//getDay  獲取當(dāng)前的星期
       document.write("<br>");
       document.write(myday.getDate());//getDate 獲取當(dāng)前的日期
       document.write("<br>");
       document.write(myday.getHours());//getHours 獲取到當(dāng)前的時鐘
       document.write("<br>");
       document.write(myday.getMinutes());//getMinutes 獲取當(dāng)前的分鐘
       document.write("<br>");
       document.write(myday.getSeconds());//getSeconds 獲取當(dāng)前秒鐘
  </script>
</head>
<body>

</body>
</html>


?? ???:查無此人?? ??:2018-11-25 09:37:42
???? ??:嗯,做的不錯。日期時間,是個麻煩的東西,要多練習(xí),才能記住。加油。

??? ??

?? ??