Sunday 26 June 2016

Python: Calendar: Calendar class

class calendar.Calendar(firstweekday=0)
Used to instantiate a Calendar object. Parameter firstweekday is used to specify first day of the week. By default 0 is Monday, 1 is Tuesday, ... 6 is Sunday.

Following table summarizes the methods in Calendar class.

Method
Description
iterweekdays()
Returns an iterator for the numbers associated for the week.
itermonthdates(year, month)
Returns an iterator for the given month in given year. In addition to return all days for the month, it returns all days before the start of the month or after the end of the month that are required to get a complete week.
itermonthdays2(year, month)
Returns an iterator for given month in given year. Days returned will be tuples consisting of a day number and a week day number.
itermonthdays(year, month)
Returns an iterator for given month in given year. Days returned will simply be day numbers.
monthdatescalendar(year, month)
Returns list of the weeks in given month and year as full weeks. Weeks are lists of seven datetime.date objects.
monthdays2calendar(year, month)
Returns list of weeks in given month in given year. Weeks are lists of seven tuples of day numbers and weekday numbers.
monthdayscalendar(year, month)
Returns list of weeks in given month in given year. Weeks are lists of seven day numbers.
yeardatescalendar(year, width=3)
Returns the data for given year. Returns the list of month rows. Each month row contains up to width months (defaulting to 3).
yeardays2calendar(year, width=3)
Return the data for the specified year. Entries in the week lists are tuples of day numbers and weekday numbers. Day numbers outside this month are zero.
yeardayscalendar(year, width=3)
Returns the data for given year. Entries in the week lists are day numbers. Day numbers outside this month are zero.




Previous                                                 Next                                                 Home

No comments:

Post a Comment