Created
March 22, 2016 01:31
-
-
Save podolskyi/bfc99732c3ad6c17cb7f to your computer and use it in GitHub Desktop.
Manipulate with datetime in Python. Convert from string.
This file contains 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
import datetime | |
# datetime objest to string | |
datetime.datetime.today().strftime("%m/%d/%Y %H:%M") | |
# from string to datetime object | |
datetime.datetime.strptime('Mar 22, 2016 00:00', "%Y%m%d %H:%M") | |
# плюс день | |
datetime.datetime.today() + datetime.timedelta(days=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment