Skip to content

Instantly share code, notes, and snippets.

@luisgdev
Created June 19, 2021 00:34
Show Gist options
  • Select an option

  • Save luisgdev/bf9515ee11b27c3899723acc05e29377 to your computer and use it in GitHub Desktop.

Select an option

Save luisgdev/bf9515ee11b27c3899723acc05e29377 to your computer and use it in GitHub Desktop.
Convert unixtime, usually found on sms backups timestamps, to human readable format.
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