Skip to content

Instantly share code, notes, and snippets.

@conr2d
Created July 20, 2020 08:39
Show Gist options
  • Save conr2d/38bed1e84ff1e4418358ae9468d84b41 to your computer and use it in GitHub Desktop.
Save conr2d/38bed1e84ff1e4418358ae9468d84b41 to your computer and use it in GitHub Desktop.
function timestampToDate(UNIX_timestamp) {
let a = new Date(UNIX_timestamp * 1000);
let months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
let year = a.getFullYear();
let month = months[a.getMonth()];
let date = a.getDate();
let hour = a.getHours();
let min = a.getMinutes();
let sec = a.getSeconds();
let time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec ;
return time;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment