獲取年月日星期幾
阿新 • • 發佈:2018-12-27
<p></p>
<script type="text/javascript">
$(function () {
var date = new Date(); //日期物件
var now = "";
var weekday = new Array(7);
weekday[0] = "星期日";
weekday[1] = "星期一";
weekday[2] = "星期二";
weekday[3] = "星期三";
weekday[4] = "星期四";
weekday[5] = "星期五";
weekday[6] = "星期六";
var nowDay = date.getDay()
now = date.getFullYear() + "年";
now = now + (date.getMonth() + 1) + "月";
now = now + date.getDate() + "日";
now = now + ',' + weekday[nowDay];
$("p").html(now);
});
</script>