Created
October 1, 2015 17:07
-
-
Save darlacameron/54a48da22f72fde256a4 to your computer and use it in GitHub Desktop.
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 parseDate(date) { | |
var months = ['Jan.', 'Feb.', 'March', 'April', 'May', 'June', 'July', 'Aug.', 'Sept.', 'Oct.', 'Nov.', 'Dec.']; | |
// get date (no time) | |
var justDate = date.split('T'); | |
var dateSplit = justDate[0].split('-'); | |
// format date and year | |
var newDate = new Date(dateSplit[0],dateSplit[1]-1,dateSplit[2]), | |
day = newDate.getDate(), | |
year = newDate.getFullYear(), | |
month = months[newDate.getMonth()], | |
date = month + ' ' + day + ', ' + year; | |
// insert into dom | |
$('#last-updated').text(date); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment