Skip to content

Instantly share code, notes, and snippets.

@takidog
Last active March 11, 2019 04:17
Show Gist options
  • Save takidog/bfd7b34bf62de755b1d425aa470705e8 to your computer and use it in GitHub Desktop.
Save takidog/bfd7b34bf62de755b1d425aa470705e8 to your computer and use it in GitHub Desktop.
hotfix
# need pip install pytz
import pytz
def _get_real_time(timestamp):
ts = timestamp/10000000 - 62135596800
utc_dt = datetime.utcfromtimestamp(ts)
aware_utc_dt = utc_dt.replace(tzinfo=pytz.utc)
tz = pytz.timezone('Asia/Taipei')
dt = aware_utc_dt.astimezone(tz)
dt = datetime.fromtimestamp(ts, tz).strftime("%Y-%m-%d %H:%M")
return dt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment