python pytz에 좀 버그가 있다.
근데, 어디서 많이 본 정상혁 아저씨가 보인다
https://github.com/stub42/pytz/blob/master/tz/asia#L1928
(참고 썸머 타임 글 관련 기고 https://d2.naver.com/helloworld/645609)
>>> import pytz
>>> from datetime import datetime
>>> fmt = '%Y-%m-%d %H:%M:%S %Z%z'
>>> seoul = pytz.timezone('Asia/Seoul')
>>> seoul
<DstTzInfo 'Asia/Seoul' LMT+8:28:00 STD>
>>> seoul_dt = seoul.localize(datetime(2018, 6, 19, 17, 53))
>>> seoul_dt.strftime(fmt)
'2018-06-19 17:53:00 KST+0900'
관련해서 내용을 올렸다.
https://github.com/stub42/pytz/issues/15
Hi!
I found a time zone issue which changed Pyongyang(North Korea) time zoned recently.
According to 'https://en.wikipedia.org/wiki/Time_in_North_Korea', I found 'On 29 April 2018, North Korean leader Kim Jong-un announced his country would be returning to UTC+9 to realign its clocks with South Korea. '. It based on the Guadian Newspaper('https://www.theguardian.com/world/2018/may/05/time-for-change-north-korea-moves-clocks-forward-to-match-south')
Below code is not match the Wiki.
import pytz
import datetime
def main():
seoul = pytz.timezone('Asia/Seoul')
print(seoul.localize(datetime.datetime.now()))
pyongyang = pytz.timezone('Asia/Pyongyang')
print(pyongyang.localize(datetime.datetime.now()))
if __name__ == '__main__':
main()
The result is below.
2018-06-19 18:23:36.818206+09:00
2018-06-19 18:23:36.818469+08:30
Second result should be equal to '2018-06-19 18:23:36.818469+09:00'
Could you change code and and document(https://github.com/stub42/pytz/blob/master/tz/asia#L1997)?
And When I test the previous example, I found another interesting sample code.
>>> import pytz
>>> from datetime import datetime
>>> fmt = '%Y-%m-%d %H:%M:%S %Z%z'
>>> seoul = pytz.timezone('Asia/Seoul')
>>> seoul
<DstTzInfo 'Asia/Seoul' KST+8:30:00 STD>
>>> pyongyang = pytz.timezone('Asia/Pyongyang')
>>> pyounyang
<DstTzInfo 'Asia/Pyongyang' KST+8:30:00 STD>
Finally, I found another interesting document. You described world timezone. Previsous menthioned, I think it should be changed.
https://github.com/stub42/pytz/blob/master/tz/asia#L47
https://github.com/stub42/pytz/blob/master/tz/asia#L50
-> I think it should be removed at '8:30 KST KDT Korea when at +0830', maintained at ''9:00 KST KDT Korea when at +09'.
Thanks in advance.
'python' 카테고리의 다른 글
[python] whois 모듈 (0) | 2018.09.03 |
---|---|
[python] OptionParser 활용하는 사례 (0) | 2018.07.04 |
[python] 웹 요청 예시 (requests, HTTPAdapter, Retry) (0) | 2018.06.04 |
[python] 특이한 문법 try-else 문 (0) | 2018.05.29 |
[python] 특이한 문법 for else 구문 예 (0) | 2018.05.29 |