Here to recommend a very good time format conversion of the JS code:
Date.prototype.Format = function (FMT) {
var o = {
"m+": This.getmonth () + 1,//month
"d+": this.getdate (),//day
"h+": this.gethours (),//hour
"m+": this.getminutes (),///min "
s+": This.getseconds (),//sec
"q+": Math.floor ((This.getmonth () + 3)/3),//Quarter
"S": this.getmilliseconds ()//Millisecond
};
if (/(y+)/.test (FMT)) FMT = Fmt.replace (regexp.$1, (this.getfullyear () + ""). substr (4-regexp.$1.length));
For (var k in O)
if (new RegExp ("+ K +")). Test (FMT)) FMT = Fmt.replace (regexp.$1, (regexp.$1.length = 1)? (O[k]): (("+ o[k]"). substr (("" + o[k). length));
return FMT;
}
var date= new Date (). Format ("Yyyy-mm-dd");//format ("Enter the time format you want: YYYY-MM-DD,YYYYMMDD")
Current time minus one day
function Daysjian () {
var date = new Date ()//Gets the current time
date.setdate (Date.getdate ()-1);/Set days-1 days
var time = Date. Format ("YyyyMMdd");
}