Skip to content

Instantly share code, notes, and snippets.

@masayukig
Last active December 25, 2015 04:09
Show Gist options
  • Save masayukig/6914620 to your computer and use it in GitHub Desktop.
Save masayukig/6914620 to your computer and use it in GitHub Desktop.
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