I am storing time in a MySQL database as a Unix timestamp and that gets sent to some JavaScript code. How would I get just the time out of it?
For example, in HH/MM/
The answer given by @Aron works, but it didn't work for me as I was trying to convert timestamp starting from 1980. So I made few changes as follows
function ConvertUnixTimeToDateForLeap(UNIX_Timestamp) {
var dateObj = new Date(1980, 0, 1, 0, 0, 0, 0);
dateObj.setSeconds(dateObj.getSeconds() + UNIX_Timestamp);
return dateObj;
}
document.body.innerHTML = 'TimeStamp : ' + ConvertUnixTimeToDateForLeap(1269700200);
So if you have a timestamp starting from another decade or so, just use this. It saved a lot of headache for me.