Created
June 19, 2021 00:34
-
-
Save luisgdev/bf9515ee11b27c3899723acc05e29377 to your computer and use it in GitHub Desktop.
Convert unixtime, usually found on sms backups timestamps, to human readable format.
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
| from datetime import datetime | |
| def decode_unixtime(utime): | |
| utime = int(str(utime)[:10]) | |
| res = datetime.fromtimestamp(utime) | |
| return res.strftime('%a %Y-%m-%d %H:%M:%S') | |
| if __name__ == '__main__': | |
| unixtime = 1600881204586 | |
| print(decode_unixtime(unixtime)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment