获取当前本地时间JavaScript:
<script type="text/javascript"> var mydate = new Date(); var nian = mydate.getFullYear(); var yue = mydate.getMonth()+1; var ri = mydate.getDate(); var xingqi = mydate.getDay(); switch(xingqi){ case 0: xingqi = "星期日";break; case 1: xingqi = "星期一";break; case 2: xingqi = "星期二";break; case 3: xingqi = "星期三";break; case 4: xingqi = "星期四";break; case 5: xingqi = "星期五";break; case 6: xingqi = "星期六";break; } document.write("今天是"+nian+"年"+yue+"月"+ri+"日 "+xingqi); </script>
原文地址:https://www.cnblogs.com/hool/p/12704361.html
时间: 2024-11-06 09:37:15