Created
July 16, 2018 17:56
-
-
Save luciovilla/698f9711186cf6ff2e44ed7e5debb98b to your computer and use it in GitHub Desktop.
Convert current date to AP style
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 dateConverter(timeStamp){ | |
var UNIX_timestamp = new Date(timeStamp.replace(/\s/, 'T')).getTime(); | |
var a = new Date(UNIX_timestamp); | |
var months = ['Jan.','Feb.','March','April','May','June','July','Aug.','Sept.','Oct.','Nov.','Dec.']; | |
var year = a.getFullYear(); | |
var month = months[a.getMonth()]; | |
var day = a.getDate(); | |
var time = month + ' ' + day + ', ' + year ; | |
return time; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment