Skip to content

Instantly share code, notes, and snippets.

@janeklb
Created January 27, 2013 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janeklb/4650320 to your computer and use it in GitHub Desktop.
Save janeklb/4650320 to your computer and use it in GitHub Desktop.
create javascript date objects using date strings, in the user's timezone
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