w3resource

Python TextCalendar Module : weekday() method

weekday() method

The weekday() method is used to returns the day of the week (0 is Monday) for year (1970–...), month (1–12), day (1–31).

Syntax:

weekday(year, month, day)

Parameters:

Name Description Required /
Optional
Type
year Year for which the calendar should be generated. Required Number
month month for which the calendar should be generated. Required Number
day day for which the calendar should be generated. Required Number

Example of weekday() method

import calendar
print(calendar.weekday(2016, 5, 15))

Output:

6

Previous: leapdays()
Next: weekheader()

Test your Python skills with w3resource's quiz



Follow us on Facebook and Twitter for latest update.