Due to the time that C # obtains through Ajax to the foreground format:/date ( 1354116249000)/
So I need to convert the return statement in format ().
FormatDate () method The parameter passed in is a timestamp, and you can get the timestamp with replace (): replace ("/date ("), "" "), and then pass in the method to get the time format.
functionFormatDate (obj) {var timestamp =Obj timestamp = Timestamp.replace (/^\s+|\s+$/, ");if (/^\d{10}$/. Test (timestamp)) {timestamp *= 1000; }Elseif (/^\d{13}$/. Test (timestamp)) {timestamp =parseint (timestamp); }Else{Return ""; }var ymdhis =Format (timestamp);ReturnYmdhis; }functionFormat (timestamp) {var time =NewDate (timestamp);var year =Time.getfullyear ();var month = (Time.getmonth () + 1) > 9 && (Time.getmonth () + 1) | | (' 0 ' + (time.getmonth () + 1) var date = Time.getdate () > 9 && time.getdate () | | (' 0 ' + time.getdate ()) var hour = time.gethours () > 9 && time.gethours () | | (' 0 ' + time.gethours ()) var minute = Time.getminutes () > 9 && time.getminutes () | | (' 0 ' + time.getminutes ()) var second = Time.getseconds () > 9 && time.getseconds () | | (' 0 ' + time.getseconds ()) var ymdhis = year + '/' + month + '/' + date + ' + hour + ': ' + Minute + ': ' + SE Cond return ymdhis;}
JS timestamp converted to time format, customizable format