Last active
March 11, 2019 04:17
-
-
Save takidog/bfd7b34bf62de755b1d425aa470705e8 to your computer and use it in GitHub Desktop.
hotfix
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
| # 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