Time zone setting inquiry

(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:

  1. Click on โ€œSecretsโ€ under the Tools tab.
  2. Enter โ€œTZโ€ into the โ€œKeyโ€ field, and type in โ€œAsia/Seoulโ€ into the value field.
  3. 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 ์ปค๋ฎค๋‹ˆํ‹ฐ์— ์˜ค์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค!
๋ฒˆ์—ญ๋œ ํ…์ŠคํŠธ:
ํ•œ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์€ ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‹œ๊ฐ„๋Œ€๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

  1. ๋„๊ตฌ ํƒญ์—์„œ "๋น„๋ฐ€"์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
  2. โ€œํ‚คโ€ ํ•„๋“œ์— "TZ"๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ๊ฐ’ ํ•„๋“œ์— "Asia/Soeul"์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
  3. "์ €์žฅ"์„ ๋ˆ„๋ฅธ ๋‹ค์Œ ์‹œ๊ฐ„์„ ์ฐธ์กฐํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

์ด ์ž์Šต์„œ๊ฐ€ ๋„์›€์ด ๋˜๊ธฐ๋ฅผ ๋ฐ”๋ผ๋ฉฐ ๋„์›€์ด ๋˜์—ˆ์œผ๋ฉด ์œ ์‚ฌํ•œ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๋‹ค๋ฅธ ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ตฌ์„ฑ์›์ด ์ด ์†”๋ฃจ์…˜์„ ์‰ฝ๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ๋„๋ก ๋‚ด ๋‹ต๋ณ€์„ "์†”๋ฃจ์…˜"์œผ๋กœ ํ‘œ์‹œํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•˜์‹ญ์‹œ์˜ค.

2 Likes

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:

  1. In the sidebar, click โ‹ฎ > Show hidden files
  2. 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"
4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.