Public processing timestamp function
Copy Code code as follows:
/**
* Process timestamp converted to date format
* @param {Object} obj timestamp {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 stored in PHP is 10 bits, and when JavaScript is processed it needs to be multiplied by 1000 to get the date format.
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 Show Time is 2013-09-16.
2. The time stamp stored in Java is 13 bits, then the date format can be obtained in JavaScript processing without any processing required
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 ());
Direct use of addstime can be 2013-09-16