Method One:
The principle is to take the middle number, and then convert to JS date type
functionChangedateformat (val) {if(val! =NULL) { varDate =NewDate (parseint ("Val.replace" ("/date"). Replace (")/", ""), 10)); //month is 0-11, so +1, month is less than 10 o'clock to fill a 0 varmonth = Date.getmonth () + 1 < 10? "0" + (date.getmonth () + 1): Date.getmonth () + 1; varcurrentdate = Date.getdate () < 10? "0" +date.getdate (): Date.getdate (); returnDate.getfullyear () + "-" + month + "-" +currentdate; } return"";}
Method Two:
var str = '/date (1333245600000+0800)/' var ar_date = [D.getfullyear (), D.getmonth () + 1 for (var i = 0; i < ar_date.length; i + +) Ar_date[i] = Dformat (Ar_date[i]); return ar_date.join ('-' function dformat (i) {return i < 10? "0" + i.ToString (): I;}}
Alert (data_string (str));
More ways to see: http://bbs.csdn.net/topics/390050932
JSON returns the time format of the database as/date (1477294037000)/, how to format the conversion in the foreground