获取当前本地时间Date
Posted hool
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取当前本地时间Date相关的知识,希望对你有一定的参考价值。
获取当前本地时间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>
以上是关于获取当前本地时间Date的主要内容,如果未能解决你的问题,请参考以下文章