Thursday 14 July 2016

Python: Calendar: Get day of the week


By using calendar.weekday(year, month, day) function, you can check whether given day is Monday Tuesday...Sunday.
>>> import calendar
>>> calendar.weekday(2015,11,9)
0
>>> 
>>> calendar.weekday(1989,5,6)
5
>>> 
>>> calendar.weekday(1988,6,6)
0


Previous                                                 Next                                                 Home

No comments:

Post a Comment