This article describes how to process a timestamp as a date in javascript. The following is a good example. If you are interested, refer to the public processing timestamp function.
The Code is as follows:
/**
* Convert the processing timestamp to the date format
* @ Param {Object} obj timestamp {10-bit timestamp must be multiplied by 1000; 13-bit timestamp is not required}
* @ Return {TypeName} return date format
*/
Function fullnum (obj ){
If (Number (obj) <10 ){
Return '0' + obj;
} Else {
Return obj;
}
}
1. The timestamp stored in PHP is 10 bits. During javascript processing, you must multiply the timestamp by 1000 to get the date format time.
The Code is as follows:
Var mystime = newDate (msg. pager. result [I]. adsdate * 1000 );
Var addstime = mystime. getFullYear () + '-' + fullnum (Number (mystime. getMonth () + 1) + '-' + fullnum (mystime. getDate ());
// The addstime display time is
2. If the timestamp stored in java is 13 BITs, you can obtain the date format time without any processing in javascript.
The Code is 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 obtain