1. function getYestoday(date){
2. var yesterday_Time()-1000*60*60*24;
3. var yesterday = new Date();
4. yesterday.setTime(yesterday_milliseconds);
5.
6. var strYear =&FullYear();
7. var strDay =&Date();
8. var strMonth =&Month()+1;
9. if(strMonth<10)
10. {
11. strMonth="0"+strMonth;
12. }
13. datastr = strYear+"-"+strMonth+"-"+strDay;
14. return datastr;
15. }
16.
17. //获得上个月在昨天这一天的日期
18. function getLastMonthYestdy(date){
19. var daysInMonth = new Array([0],[31],[28],[31],[30],[31],[30],[31],[31],[30],[31],[30],[31]);
20. var strYear =&FullYear();
21. var strDay =&Date();
22. var strMonth =&Month()+1;
23. if(strYear%4 == 0 && strYear%100 != 0){
24. daysInMonth[2] = 29;
25. }
26. if(strMonth - 1 == 0)
27. {
28. strYear -= 1;
29. strMonth = 12;
30. }
31. else
32. {
33. strMonth -= 1;
34. }
35. strDay = daysInMonth[strMonth] >= strDay ? strDay : daysInMonth[strMonth];
36. if(strMonth<10)
37. {
38. strMonth="0"+strMonth;
39. }
40. if(strDay<10)
41. {
42. strDay="0"+strDay;
43. }
44. datastr = strYear+"-"+strMonth+"-"+strDay;
45. return datastr;
46. }
47.
48. //获得上一年在昨天这一天的日期
49. function getLastYearYestdy(date){
50. var strYear =&FullYear() - 1;
51. var strDay =&Date();
52. js当前日期加一天 var strMonth =&Month()+1;
53. if(strMonth<10)
54. {
55. strMonth="0"+strMonth;
56. }
57. if(strDay<10)
58. {
59. strDay="0"+strDay;
60. }
61. datastr = strYear+"-"+strMonth+"-"+strDay;
62. return datastr;
63. }
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论