Lines Matching refs:year
102 def isleap(year):
104 return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
115 def weekday(year, month, day):
116 """Return weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31)."""
117 if not datetime.MINYEAR <= year <= datetime.MAXYEAR:
118 year = 2000 + year % 400
119 return datetime.date(year, month, day).weekday()
122 def monthrange(year, month):
124 year, month."""
127 day1 = weekday(year, month, 1)
128 ndays = mdays[month] + (month == February and isleap(year))
132 def _monthlen(year, month):
133 return mdays[month] + (month == February and isleap(year))
136 def _prevmonth(year, month):
138 return year-1, 12
140 return year, month-1
143 def _nextmonth(year, month):
145 return year+1, 1
147 return year, month+1
175 def itermonthdates(self, year, month):
181 for y, m, d in self.itermonthdays3(year, month):
184 def itermonthdays(self, year, month):
189 day1, ndays = monthrange(year, month)
196 def itermonthdays2(self, year, month):
201 for i, d in enumerate(self.itermonthdays(year, month), self.firstweekday):
204 def itermonthdays3(self, year, month):
206 Like itermonthdates(), but will yield (year, month, day) tuples. Can be
209 day1, ndays = monthrange(year, month)
212 y, m = _prevmonth(year, month)
217 yield year, month, d
218 y, m = _nextmonth(year, month)
222 def itermonthdays4(self, year, month):
224 Like itermonthdates(), but will yield (year, month, day, day_of_week) tuples.
227 for i, (y, m, d) in enumerate(self.itermonthdays3(year, month)):
230 def monthdatescalendar(self, year, month):
235 dates = list(self.itermonthdates(year, month))
238 def monthdays2calendar(self, year, month):
245 days = list(self.itermonthdays2(year, month))
248 def monthdayscalendar(self, year, month):
253 days = list(self.itermonthdays(year, month))
256 def yeardatescalendar(self, year, width=3):
258 Return the data for the specified year ready for formatting. The return
264 self.monthdatescalendar(year, i)
269 def yeardays2calendar(self, year, width=3):
271 Return the data for the specified year ready for formatting (similar to
277 self.monthdays2calendar(year, i)
282 def yeardayscalendar(self, year, width=3):
284 Return the data for the specified year ready for formatting (similar to
289 self.monthdayscalendar(year, i)
372 Returns a year's calendar as a multi-line string.
408 """Print a year's calendar."""
432 # CSS class for the year's table head
433 cssclass_year_head = "year"
435 # CSS class for the whole year table
436 cssclass_year = "year"
502 Return a formatted year as a table of tables.
526 Return a formatted year as a complete HTML page.
633 # Spacing of month columns for multi-column year calendar
639 """Prints multi-column formatting for year calendars"""
655 year, month, day, hour, minute, second = tuple[:6]
656 days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
710 "year",
712 help="year number (1-9999)"
738 if options.year is None:
739 write(cal.formatyearpage(datetime.date.today().year, **optdict))
741 write(cal.formatyearpage(options.year, **optdict))
754 if options.year is None:
755 result = cal.formatyear(datetime.date.today().year, **optdict)
757 result = cal.formatyear(options.year, **optdict)
759 result = cal.formatmonth(options.year, options.month, **optdict)