Lines Matching defs:month
51 def _days_in_month(year, month):
52 "year, month -> number of days in that month in that year."
53 assert 1 <= month <= 12, month
54 if month == 2 and _is_leap(year):
56 return _DAYS_IN_MONTH[month]
58 def _days_before_month(year, month):
59 "year, month -> number of days in year preceding first day of month."
60 assert 1 <= month <= 12, 'month must be in 1..12'
61 return _DAYS_BEFORE_MONTH[month] + (month > 2 and _is_leap(year))
63 def _ymd2ord(year, month, day):
64 "year, month, day -> ordinal, considering 01-Jan-0001 as day 1."
65 assert 1 <= month <= 12, 'month must be in 1..12'
66 dim = _days_in_month(year, month)
69 _days_before_month(year, month) +
89 "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1."
135 # the month via an estimate that's either exact or one too large.
138 month = (n + 50) >> 5
139 preceding = _DAYS_BEFORE_MONTH[month] + (month > 2 and leapyear)
141 month -= 1
142 preceding -= _DAYS_IN_MONTH[month] + (month == 2 and leapyear)
144 assert 0 <= n < _days_in_month(year, month)
146 # Now the year and month are correct, and n is the offset from the
147 # start of that month: we're done!
148 return year, month, n+1
350 month = int(dtstr[pos:pos + 2])
358 return [year, month, day]
515 def _check_date_fields(year, month, day):
517 month = _index(month)
521 if not 1 <= month <= 12:
522 raise ValueError('month must be in 1..12', month)
523 dim = _days_in_month(year, month)
526 return year, month, day
919 year, month, day
923 def __new__(cls, year, month=None, day=None):
928 year, month, day (required, base 1)
930 if (month is None and
947 year, month, day = _check_date_fields(year, month, day)
950 self._month = month
973 January 1 of year 1 is day 1. Only the year, month and day are
1067 def month(self):
1068 """month (1-12)"""
1085 """Return proleptic Gregorian ordinal for the year, month and day.
1087 January 1 of year 1 is day 1. Only the year, month and day values
1092 def replace(self, year=None, month=None, day=None):
1096 if month is None:
1097 month = self._month
1100 return type(self)(year, month, day)
1670 """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
1672 The year, month and day arguments are required. tzinfo may be None, or an
1677 def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0,
1692 self.__setstate(year, month)
1695 year, month, day = _check_date_fields(year, month, day)
1701 self._month = month
1822 return cls(date.year, date.month, date.day,
1866 return _build_struct_time(self.year, self.month, self.day,
1918 y, m, d = self.year, self.month, self.day
1935 def replace(self, year=None, month=None, day=None, hour=None,
1941 if month is None:
1942 month = self.month
1957 return type(self)(year, month, day, hour, minute, second,
2236 days = _ymd2ord(self.year, self.month, self.day)