example code:
<script> var now=new Date(); var currentDate=now.getDate(); var currentMonth=now.getMonth(); var currentYear=now.getYear(); var tomorrow=new Date(currentYear,currentMonth,currentDate+1); var lastWeek=new Date(currentYear,currentMonth,currentDate-7); var lastMonth=new Date(currentYear,currentMonth-1,currentDate); </script>
result:
tomorrow: Sun Sep 9 00:00:00 UTC+0900 2012 last week: Sat Sep 1 00:00:00 UTC+0900 2012 last month: Wed Aug 8 00:00:00 UTC+0900 2012
No comments:
Post a Comment