Created
February 1, 2016 16:06
-
-
Save 3ffusi0on/4ff5c506f032f5c7cfea to your computer and use it in GitHub Desktop.
Javascript timestamp to date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timestampToDateString(timestamp){ | |
var a = new Date(UNIX_timestamp * 1000); | |
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; | |
var year = a.getFullYear(); | |
var month = months[a.getMonth()]; | |
var date = a.getDate(); | |
var hour = a.getHours(); | |
var min = a.getMinutes(); | |
var sec = a.getSeconds(); | |
var 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