Skip to content

Instantly share code, notes, and snippets.

@galileoguzman
Created October 28, 2015 19:02
Show Gist options
  • Save galileoguzman/461ddf7d54d6f7106265 to your computer and use it in GitHub Desktop.
Save galileoguzman/461ddf7d54d6f7106265 to your computer and use it in GitHub Desktop.
How to convert unix timestamp to datetime python class
## IMPORT THE DATETIME MODULE
import datetime
## CONVERT THE RAW STRING WITH STRFTIME METHOD
print(
datetime.datetime.fromtimestamp(
int("1284101485")
).strftime('%Y-%m-%d %H:%M:%S')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment