month_first_last

Run Settings
LanguagePython
Language Version
Run Command
from datetime import date, timedelta import calendar today = date.today() this_month_first = today.replace(day=1) this_month_first_str = this_month_first.strftime("%Y-%m-%d") this_month_last_str = today.replace( day=calendar.monthrange(today.year, today.month)[1] ).strftime("%Y-%m-%d") prev_month_last = this_month_first - timedelta(days=1) prev_month_first = prev_month_last.replace(day=1) prev_month_first_str = prev_month_first.strftime("%Y-%m-%d") prev_month_last_str = prev_month_last.strftime("%Y-%m-%d") print(prev_month_first_str) print(prev_month_last_str) print(this_month_first_str) print(this_month_last_str)
Editor Settings
Theme
Key bindings
Full width
Lines