We are going to convert epoch timestamp into a date-time string.
function convertDateTime(timeStamp){
var milliSecTimeStamp = 0;
if(String(timeStamp).length <= 10){
milliSecTimeStamp = parseInt(timeStamp)*1000;
}else{
milliSecTimeStamp = parseInt(timeStamp);
}
var dateTime = new Date(milliSecTimeStamp);
var date = dateTime.getDate();
var month = dateTime.getMonth();
var year = dateTime.getFullYear();
var dateFormat = date+'-'+month+'-'+year;
return dateFormat;
}
Comments
Post a Comment