Skip to content

Instantly share code, notes, and snippets.

@franciscojsc
Created October 31, 2021 21:42
Show Gist options
  • Save franciscojsc/0efdbb86159e79669b55b4321e037622 to your computer and use it in GitHub Desktop.
Save franciscojsc/0efdbb86159e79669b55b4321e037622 to your computer and use it in GitHub Desktop.
Como pegar a data de acordo com o Timezone em JavaScript
const ny = new Date().toLocaleString("en-US", {timeZone: "America/New_York"})
const sp = new Date().toLocaleString("pt-BR", {timeZone: "America/Sao_Paulo"})
console.log(ny);
// 10/31/2021, 5:41:08 PM
console.log(sp);
// 31/10/2021 18:41:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment