DESCRIPTION:
To get the number of weekdays in a specific month, we need to use the busday_count() function of a numpy module. Pass the start date and end date to the busday_count() in a yyyy-mm format.
CODE:
# importing date class from datetime module
from datetime import date
# creating the date object of today’s date
todays_date = date.today()
# printing todays date
print(“Current date: “, todays_date)
# fetching the current year, month and day of today
print(“Current year:”, todays_date.year)
print(“Current month:”, todays_date.month)
print(“Current day:”, todays_date.day)
OUTPUT:
Current date: 2020-12-10
Current year: 2020
Current month: 12
Current day: 10