Last active
August 4, 2017 02:32
-
-
Save Shih-Po/92c044627ddb766d90d95bc0e34f207a to your computer and use it in GitHub Desktop.
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, timedelta | |
| def get_last_month_datetime(now): | |
| return now.replace(day=1) - timedelta(days=1) | |
| now = datetime.now() | |
| last_month_datetime = get_last_month_datetime(now) | |
| print(last_month_datetime) | |
| before_last_month_datetime = get_last_month_datetime( | |
| get_last_month_datetime(now) | |
| ) | |
| print(before_last_month_datetime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment