Created
October 18, 2011 20:02
-
-
Save danro/1296539 to your computer and use it in GitHub Desktop.
Twitter date string regex replace, IE8 fix
This file contains hidden or 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 s = "Fri Apr 09 12:53:54 +0000 2010"; | |
| var date = new Date(s.replace(/^\w+ (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/, "$1 $2 $4 $3 UTC")); | |
| // Cross-browser, time-zone-aware parsing via JavaScript: | |
| // Tested on IE, Firefox, Safari, Chrome and Opera. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment