Skip to content

Instantly share code, notes, and snippets.

@Dexdot
Created October 31, 2021 23:20
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 Dexdot/c63f4b81c162977c7fd6df12f94ca822 to your computer and use it in GitHub Desktop.
Save Dexdot/c63f4b81c162977c7fd6df12f94ca822 to your computer and use it in GitHub Desktop.
function createDateAsUTC(date) {
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
}
function convertDateToUTC(date) {
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment