SQL Server中获取当前日期的年.月.日.时.分.秒数据: SELECT GETDATE() as '当前日期',DateName(year,GetDate()) as '年',DateName(month,GetDate()) as '月',DateName(day,GetDate()) as '日',DateName(dw,GetDate()) as '星期',DateName(week,GetDate()) as '周数',DateName(hour,GetDate()) as '时…
var now = new Date(); var fd = new Date(now.getFullYear(), now.getMonth()-1 ,1).toLocaleDateString(); var ed = new Date(now.getFullYear(), now.getMonth(), 0).toLocaleDateString(); console.log(fd); console.log(ed);…
javascript根据当前日期获取上个月日期 function lastMonthDate(){ var Nowdate = new Date(); var vYear = Nowdate.getFullYear(); var vMon = Nowdate.getMonth() + 1; var vDay = Nowdate.getDate(); //每个月的最后一天日期(为了使用月份便于查找,数组第一位设为0) var daysInMonth = new Array(0,31,28,31,3…
1.yyyy-mm-dd获取上个月 function getUpMonth(t){ var tarr = t.split('-'); var year = tarr[0]; //获取当前日期的年 var month = tarr[1]; //获取当前日期的月 var day = tarr[2]; //获取当前日期的日 var days = new Date(year,month,0); days = days.getDate();//获取当前日期中的月的天数 var year2 = year;…