Created
January 27, 2013 20:33
-
-
Save janeklb/4650320 to your computer and use it in GitHub Desktop.
create javascript date objects using date strings, in the user's timezone
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 dateInLocalTimezone(simpleDateString) { | |
var date = new Date(simpleDateString), millis = date.getTime(); | |
date.setTime(millis + date.getTimezoneOffset() * 60 * 1000); | |
return date; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment