Lines Matching refs:month
46 def _days_in_month(year, month):
47 "year, month -> number of days in that month in that year."
48 assert 1 <= month <= 12, month
49 if month == 2 and _is_leap(year):
51 return _DAYS_IN_MONTH[month]
53 def _days_before_month(year, month):
54 "year, month -> number of days in year preceding first day of month."
55 assert 1 <= month <= 12, 'month must be in 1..12'
56 return _DAYS_BEFORE_MONTH[month] + (month > 2 and _is_leap(year))
58 def _ymd2ord(year, month, day):
59 "year, month, day -> ordinal, considering 01-Jan-0001 as day 1."
60 assert 1 <= month <= 12, 'month must be in 1..12'
61 dim = _days_in_month(year, month)
64 _days_before_month(year, month) +
84 "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1."
130 # the month via an estimate that's either exact or one too large.
133 month = (n + 50) >> 5
134 preceding = _DAYS_BEFORE_MONTH[month] + (month > 2 and leapyear)
136 month -= 1
137 preceding -= _DAYS_IN_MONTH[month] + (month == 2 and leapyear)
139 assert 0 <= n < _days_in_month(year, month)
141 # Now the year and month are correct, and n is the offset from the
142 # start of that month: we're done!
143 return year, month, n+1
145 # Month and day names. For localized versions, see the calendar module.
267 month = int(dtstr[5:7])
274 return [year, month, day]
396 def _check_date_fields(year, month, day):
398 month = _check_int_field(month)
402 if not 1 <= month <= 12:
403 raise ValueError('month must be in 1..12', month)
404 dim = _days_in_month(year, month)
407 return year, month, day
800 year, month, day
804 def __new__(cls, year, month=None, day=None):
809 year, month, day (required, base 1)
811 if (month is None and
828 year, month, day = _check_date_fields(year, month, day)
831 self._month = month
854 January 1 of year 1 is day 1. Only the year, month and day are
936 def month(self):
937 """month (1-12)"""
954 """Return proleptic Gregorian ordinal for the year, month and day.
956 month and day values
961 def replace(self, year=None, month=None, day=None):
965 if month is None:
966 month = self._month
969 return type(self)(year, month, day)
1510 """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
1512 The year, month and day arguments are required. tzinfo may be None, or an
1517 def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0,
1532 self.__setstate(year, month)
1535 year, month, day = _check_date_fields(year, month, day)
1541 self._month = month
1662 return cls(date.year, date.month, date.day,
1700 return _build_struct_time(self.year, self.month, self.day,
1752 y, m, d = self.year, self.month, self.day
1769 def replace(self, year=None, month=None, day=None, hour=None,
1775 if month is None:
1776 month = self.month
1791 return type(self)(year, month, day, hour, minute, second,
2076 days = _ymd2ord(self.year, self.month, self.day)