Public processing timestamp function
Copy code code as follows:
/**
* Time stamp convert to the date format
* @param {Object} Obj Time Stamp {10 -bit timestamp needs to be multiplied by 1000; 13 -bit timestamp does not need}
* @Return {typename} Return date format 2013-09-16
*/
Function Fullnum (OBJ) {
if (number (obj) <10) {{
Return '0' + obj;
} Else {
Return obj;
}
}
1. The time stamp in the PHP is 10 bits, and after JavaScript processing is required to be multiplied by 1000, the time format can be obtained
Copy code code as follows:
var mystime = newdate (msg.pager.Result [i] .adsdate * 1000);
var addstime = mystime.getfullyear () + '-' + fullnum (number (mystime.getmonth ()) + 1) + '-' + fullnum (mystime.getdate ()));
// adDStime shows the time of 2013-09-16
2. The timestamp in the Java is 13 digits, so you can get the time format of the date format without any processing in JavaScript.
Copy code code as follows:
var mystime = newDate (msg.pager.Result [i] .adsdate);
var addstime = mystime.getfullyear () + '-' + fullnum (number (mystime.getmonth ()) + 1) + '-' + fullnum (mystime.getdate ()));
// Use adDStime directly to get 2013-09-16