function getLastMonth(){ var now=new Date(); var year = now.getFullYear();//getYear()+1900=getFullYear() var month = now.getMonth() +1;//0-11表示1-12月 var day = now.getDate(); var dateObj = {}; if(parseInt(month)<10){ month = "0"+month; } if(pa…
//obtain timestamp of last week var now=new Date() var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getFullYear(); //当前年 //obtain time of last month var lastMonthDate…
1.在讲js获取给定月份的N个月后的日期之前,小颖先给大家讲下getFullYear().getYear()的区别. ①getYear() var d = new Date() console.log(d.getYear()); 打印结果为:116 小颖百度了下,js中Date对象getYear()方法和getFullYear()方法区别,比如:JS中Date对象getYear()方法和getFullYear()方法区别发现很多人写的是: 在IE中是可以正确获取年份:2016,但是在FF等浏览器…