var SetSearchDate = function (sign, sid, eid) {//sign 标识符区分本周本月本年,sid开始时间id,eid结束时间id var now = new Date(); var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowMonth = now.getMonth() + 1; //当前月 var nowYear = now.getFullYear(); //当前年 if (sign == 1)//本周
<script type="text/javascript"> function GetDateStr(AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期 var y = dd.getFullYear(); ;//获取当前月份的日期 var d = dd.getDate(); return y+"-"+m+"-
talk is cheap,show me the code! //获取昨天 var day1 = new Date(); day1.setTime(day1.getTime()-24*60*60*1000); var yesterDate = day1.getFullYear()+"/" + (day1.getMonth()+1) + "/" + day1.getDate(); //获取当前日期 var date = new Date(); var year =
//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
function formatDate (val) { // 格式化时间 let start = new Date(val) let y = start.getFullYear() let m = (start.getMonth() + 1) > 10 ? (start.getMonth() + 1) : '0' + (start.getMonth() + 1) let d = start.getDate() > 10 ? start.getDate() : '0' + start.getDa
var birthday = new Date("Jan 01, 1983 01:15:00") var formatDate = function (date) { var y = date.getUTCFullYear(); var m = date.getUTCMonth() + 1; m = m < 10 ? '0' + m : m; var d = date.
var mydate = new Date(); var yester = mydate-24*60*60*1000; var yesterday = new Date(); yesterday.setTime(yester); var str = "" + yesterday.getFullYear() + "-"; if (yesterday.getMonth()>=9) { str+=(yesterday.getMonth()+1) + "-&