Skip to content

Instantly share code, notes, and snippets.

@lvl99
Created November 19, 2019 10:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lvl99/af20ee34f0c6e3984b29e8f0f794a319 to your computer and use it in GitHub Desktop.
Save lvl99/af20ee34f0c6e3984b29e8f0f794a319 to your computer and use it in GitHub Desktop.
Date ISO string without timezone information
const controlDate = new Date();
controlDate.toString();
// -> "Thu Jun 20 2019 11:16:28 GMT+0200 (Central European Summer Time)"
controlDate.toDateString();
// -> "Thu Jun 20 2019"
controlDate.toUTCString();
// -> "Thu, 20 Jun 2019 09:15:28 GMT"
controlDate.toISOString();
// -> "2019-06-20T09:16:28.244Z"
new Date(controlDate.toUTCString()).toISOString();
// -> "2019-06-20T09:16:28.000Z"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment