Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save motss/71ef2c4844e172799fadb3ab670f9133 to your computer and use it in GitHub Desktop.
Save motss/71ef2c4844e172799fadb3ab670f9133 to your computer and use it in GitHub Desktop.
Convert native Date object with timezone offset
d = new Date();
dl = new Date(d.getTime() - d.getTimezoneOffset() * 60 * 1E3);
console.log(d);
console.log(dl.toISOString());
console.log(d.getTimezoneOffset / -60);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment