(Translated by google) I am using node.js program. I want to change the time zone to KST. but I donโt know the change code. Please tell me how.
@noderun welcome to the community!
Translated Text:
one method is to set the timezone with an environment variable:
- Click on โSecretsโ under the Tools tab.
- Enter โTZโ into the โKeyโ field, and type in โAsia/Seoulโ into the value field.
- Press โSaveโ, then type in code that references the time.
I hope that this tutorial helps, and if it did, consider marking my answer as โSolutionโ so that other community members with similar issues can easily locate this solution.
@noderun ์ปค๋ฎค๋ํฐ์ ์ค์ ๊ฒ์ ํ์ํฉ๋๋ค!
๋ฒ์ญ๋ ํ
์คํธ:
ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ์๊ฐ๋๋ฅผ ์ค์ ํ๋ ๊ฒ์
๋๋ค.
- ๋๊ตฌ ํญ์์ "๋น๋ฐ"์ ํด๋ฆญํฉ๋๋ค.
- โํคโ ํ๋์ "TZ"๋ฅผ ์ ๋ ฅํ๊ณ ๊ฐ ํ๋์ "Asia/Soeul"์ ์ ๋ ฅํฉ๋๋ค.
- "์ ์ฅ"์ ๋๋ฅธ ๋ค์ ์๊ฐ์ ์ฐธ์กฐํ๋ ์ฝ๋๋ฅผ ์ ๋ ฅํฉ๋๋ค.
์ด ์์ต์๊ฐ ๋์์ด ๋๊ธฐ๋ฅผ ๋ฐ๋ผ๋ฉฐ ๋์์ด ๋์์ผ๋ฉด ์ ์ฌํ ๋ฌธ์ ๊ฐ ์๋ ๋ค๋ฅธ ์ปค๋ฎค๋ํฐ ๊ตฌ์ฑ์์ด ์ด ์๋ฃจ์ ์ ์ฝ๊ฒ ์ฐพ์ ์ ์๋๋ก ๋ด ๋ต๋ณ์ "์๋ฃจ์ "์ผ๋ก ํ์ํ๋ ๊ฒ์ ๊ณ ๋ คํ์ญ์์ค.
Tried it, but no change. Any other Way?
you could specify the timezone while converting the date object (a timestamp independent of timezones) to a locale time (dependent on timezones) like so:
d.toLocaleString('ko_KR', { timeZone: 'Asia/Seoul' })
Where should I enter this item?
Anytime you want to get the local time string
was spelt incorrectly. Set it to Asia/Seoul
.
An alternative way, which makes it still work if someone forks the repl:
- In the sidebar, click โฎ > Show hidden files
- Add/change in the
.replit
file:
[env]
TZ = "Asia/Seoul"
If you want to also change the time format to Korean, also add:
LANG = "ko_KR"
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.