Created
October 31, 2021 21:42
-
-
Save franciscojsc/0efdbb86159e79669b55b4321e037622 to your computer and use it in GitHub Desktop.
Como pegar a data de acordo com o Timezone em JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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