Last active
December 25, 2015 04:09
-
-
Save masayukig/6914620 to your computer and use it in GitHub Desktop.
Original code from http://d.hatena.ne.jp/zyxwv/20090118/1232270018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import os | |
def utc2jst(utc_in_twitter_format): | |
utc = (datetime.datetime. | |
strptime(utc_in_twitter_format, '%a %b %d %H:%M:%S +0000 %Y')) | |
td = datetime.timedelta(hours=9) # JST is 9 hours later than UTC | |
return utc+td | |
jst = os.environ.get("UTC") | |
print(utc2jst(jst)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment