
The majority of the world puts days in front of months in their dates:
However, there can be cases when you get as input a date where the month is in front of the day.
Continue readingSoftware engineering and personal development

The majority of the world puts days in front of months in their dates:
However, there can be cases when you get as input a date where the month is in front of the day.
Continue reading
If you need to get the number of days in a month in Python, you can do that quite quickly.
We are going to do that using the calendar module.
First, import the calendar module and then call the method monthrange() which returns the first_day and also the number_of_days in a month.
Let us see this in action:
import calendarContinue reading
# Get current month
_, number_of_days = calendar.monthrange(2023, 2)
print(number_of_days) # 28

In some companies, they pay their employees on the first day of every month.
If you want to know what day of the week will that be, you can find that quickly in Python using the calendar module.
Let us assume that you want to check the first day of the next month:
import calendarContinue reading
first_day, _ = calendar.monthrange(2022, 12)
© 2026 Fatos Morina
Theme by Anders Noren — Up ↑