javascript 获取日期和星期

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>TT</title>
  <script src="jquery.js"></script>
</head>
<body>
<p style="line-height: 50%;"><span></span></p>
<input type="button" value="轻轻" onclick="syncTime()">
<script>
    function syncTime(){
       var mydate = new Date();
       var week;
       switch (mydate.getDay()){
       case 1: week="星期一"; break;
       case 2: week="星期二"; break;
       case 3: week="星期三"; break;
       case 4: week="星期四"; break;
       case 5: week="星期五"; break;
       case 6: week="星期六"; break;
       default: week="星期天";
       }
       var str = "" + mydate.getFullYear() + " 年 " + (mydate.getMonth() + 1) + " 月 " + mydate.getDate() + " 日 " + week;
       $('.todaytime')[0].innerHTML = str;
       str = '"savesynctime" : "' + str + '"'
       return str;
    }
    console.log(syncTime());
</script>
</body>
</html>