Created
September 15, 2015 04:51
-
-
Save akiniwa/aa3514b118a5aa91d114 to your computer and use it in GitHub Desktop.
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 | |
from datetime import timedelta | |
# 現在時刻 | |
now = datetime.datetime.now() | |
# 文字列へのフォーマット | |
now.strftime('%Y-%m-%d') # => '2015-09-15' | |
# 引き算 | |
now - datetime.timedelta(days=2) | |
# => datetime.datetime(2015, 9, 13, 13, 44, 23, 781768) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment