+ -
当前位置:首页 → 问答吧 → HTML中昨天、上个月怎么表示?

HTML中昨天、上个月怎么表示?

时间:2011-12-17

来源:互联网

RT

作者: zhuyuanxia453017973   发布时间: 2011-12-17

HTML code
<script>
var n = new Date();
alert("昨天:" + (new Date(n.getFullYear(),n.getMonth(),n.getDate()-1)).toDateString());
alert("上个月:" + (new Date(n.getFullYear(),n.getMonth()-1,n.getDate())).toDateString());
</script>

作者: p2227   发布时间: 2011-12-17