>>> d = dateutil.parser.parse('2015-01-01 00:00:00+00') >>> d datetime.datetime(2015, 1, 1, 0, 0, tzinfo=tzutc()) >>> d.astimezone(dateutil.tz.tzlocal()) datetime.datetime(2015, 1, 1, 9, 0, tzinfo=tzlocal()) >>> d.astimezone(dateutil.tz.tzlocal()).strftime('%c') '01/01/15 09:00:00' >>> d.astimezone(dateutil.tz.tzlocal()).strftime('%z') '+0900' >>> d.astimezone(dateutil.tz.tzlocal()).strftime('%X') '09:00:00'
Created
April 11, 2015 07:18
-
-
Save aodag/0cee079e1a0a9c574f5d to your computer and use it in GitHub Desktop.
UTC表記の日時をパースしてローカルタイムゾーンで表示するまで
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment