Horje
python first day of last month Code Example
python first day of last month
from datetime import date, timedelta

last_day_of_prev_month = date.today().replace(day=1) - timedelta(days=1)

start_day_of_prev_month = date.today().replace(day=1) - timedelta(days=last_day_of_prev_month.day)

# For printing results
print("First day of prev month:", start_day_of_prev_month)
print("Last day of prev month:", last_day_of_prev_month)
first day of the month python
from datetime import datetime

datetime.today().replace(day=1)
python datetime last day of month
>>import calendar
>>year, month = 2016, 12
>>calendar.monthrange(year, month)[1]
31




Python

Related
combination python Code Example combination python Code Example
how to make a hidden file in python Code Example how to make a hidden file in python Code Example
is prime python Code Example is prime python Code Example
python count null values in dataframe Code Example python count null values in dataframe Code Example
pandas drop empty columns Code Example pandas drop empty columns Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7