Last active
December 30, 2015 09:18
-
-
Save connortreacy/7807945 to your computer and use it in GitHub Desktop.
Function for 'parsing' a datestamp in the format returned by Parse for the createdAt / updatedAt fields. Written in JavaScript, but the regex is portable.
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
var parseDate = function(parseDateString) { | |
var pattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d+)Z$/g; | |
var match = pattern.exec(parseDateString); | |
var date = new Date(match[1],parseInt(match[2])-1,match[3]-1,match[4],match[5],match[6],match[7]); | |
return date; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment