Replies: 5 comments 6 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
UTC 를 주입하는 경우라면, 2번 선호합니다. |
Beta Was this translation helpful? Give feedback.
-
저는 일단 UTC 사용을 지양해야한다고 생각합니다. 외부 시스템에서 UTC를 필요로 하는 경우 그 연결점에서만 UTC로 변환을 하면 되고, 만약 외부시스템으로 export하는 코드 등의 경우 UTC를 사용한다면, (위와 같은 상황에서 불가피하게) [정리] [배경]
|
Beta Was this translation helpful? Give feedback.
-
본 논의의 주제와 연관된 새로운 제안입니다. 제안KST나 UTC 등 시간대 상수를 특정 모듈에 선언하고 다른 모든 파일에서 그 모듈의 상수를 불러 쓰는 구현은 어떨까요? 효과시간대를 한 방식으로만 가져옵니다. 시간대 코드가 django나 python에 의존하지 않게 됩니다. 예시 구현예를 들어 core.utils 패키지 내에 timezone.py를 아래와 같이 작성합니다. from zoneinfo import ZoneInfo
KST = ZoneInfo('Asia/Seoul')
UTC = ZoneInfo('UTC') # 혹은 datetime.timezone.utc |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
datetime.datetime 객체를 생성할 때 tzinfo 매개변수에 시간대 값을 주입합니다. UTC 시간대를 입력할 경우 아래 두 가지 방법이 가능합니다. 어떤 것을 권장하면 좋을까요?
datetime.timezone.utc
zoneinfo.ZoneInfo('UTC')
Beta Was this translation helpful? Give feedback.
All reactions