Encounter a small demand, because to fill the date plug-in data, the foreground to the Java background from the date type of data into the YYYY-MM-DD format of time data. With JSON transmission, Java's date type data is automatically converted to a timestamp, such as "1470672000000".
JS Processing code:
function FormatDate (date) {dates= Date.split ("/"); if(Dates.length = =3) { if(dates[1].length = =1) {dates[1] ="0"+ dates[1]; } if(dates[2].length = =1) {dates[2] ="0"+ dates[2]; } Date= Dates.join ("-"); returndate; } Else { return NULL; }}function Parsetime (timestamp) {varDate =NewDate (parseint (timestamp)). toLocaleDateString ();
The output is 2016/8/9 date=formatdate (date);
The output is 2016-08-09 and meets the YYYY-MM-DD format requirementsreturndate;}
"1470672000000" after the Parsetime function processing result is "2016-08-09".
"JavaScript" JS converts Java timestamp to date type