Look first:
The date of the most recent week is now displayed.
Calculateclosedate ();
Defines a function that initializes a date
function Calculateclosedate () {
var nowtime1=new Date ();
Get today's month, if month is less than 10, front + "0"
var months1=nowtime1.getmonth () +1<10? " 0 "+ (Nowtime1.getmonth () +1): Nowtime1.getmonth () +1;
Get today how many numbers, if less than 10, front + "0";
var dates1=nowtime1.getdate () <10? " 0 "+nowtime1.getdate (): Nowtime1.getdate ();
Get today's Year
var years1=nowtime1.getfullyear ();
Define the time of the previous week
var nowtime2=new date (new Date ()). GetTime () -7*24*3600*1000);
Convert to Standard month format
var months2=nowtime2.getmonth () +1<10? " 0 "+ (Nowtime2.getmonth () +1): Nowtime2.getmonth () +1;
Get What day
var dates2=nowtime2.getdate () <10? " 0 "+nowtime2.getdate (): Nowtime2.getdate ();
Get year
var years2=nowtime2.getfullyear ();
Finally stitching into the required date string format
Today's date
var date1=years1+ "-" +months1+ "-" +DATES1; "2016-07-16"
One week before
var date2=years2+ "-" +months2+ "-" +DATES2; "2016-07-23"
Initialize Assignment
$ (' # $Cdatestart '). Val (Date2);
$ (' # $Cdateend '). Val (date1);
}
Query the time of the most recent week, the value of the time.