Created
October 25, 2012 17:02
-
-
Save Tukki/3954052 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 | |
yestoday = datetime.date.today() - datetime.timedelta(days=1) | |
print yestoday | |
yestoday_datetime = datetime.datetime.combine(yestoday, datetime.time.min) | |
print yestoday_datetime | |
yestoday_datetime = datetime.datetime.combine(yestoday, datetime.time()) | |
print yestoday_datetime | |
the_time = yestoday_datetime + datetime.timedalta(hours=6) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment