Last active
October 12, 2015 06:47
-
-
Save wfwei/3986654 to your computer and use it in GitHub Desktop.
python datetime from datetime to timestamp
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 | |
| import time | |
| now = datetime.now() | |
| u = str(long(time.mktime(now.timetuple()))) |
Author
Author
datetime.now().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
import datetime
print(datetime.datetime.fromtimestamp(int("1284101485")).strftime('%Y-%m-%d %H:%M:%S'))