Lines Matching defs:month
109 /* M is a char or int claiming to be a valid month. The macro is equivalent
189 /* For each month ordinal in 1..12, the number of days in that month,
190 * and the number of days before that month in the same year. These
216 /* year, month -> number of days in that month in that year */
218 days_in_month(int year, int month)
220 assert(month >= 1);
221 assert(month <= 12);
222 if (month == 2 && is_leap(year))
225 return _days_in_month[month];
228 /* year, month -> number of days in year preceding first day of month */
230 days_before_month(int year, int month)
234 assert(month >= 1);
235 assert(month <= 12);
236 days = _days_before_month[month];
237 if (month > 2 && is_leap(year))
264 /* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */
266 ord_to_ymd(int ordinal, int *year, int *month, int *day)
323 *month = 12;
329 * find the month via an estimate that's either exact or one too
334 *month = (n + 50) >> 5;
335 preceding = (_days_before_month[*month] + (*month > 2 && leapyear));
338 *month -= 1;
339 preceding -= days_in_month(*year, *month);
343 assert(n < days_in_month(*year, *month));
348 /* year, month, day -> ordinal, considering 01-Jan-0001 as day 1. */
350 ymd_to_ord(int year, int month, int day)
352 return days_before_year(year) + days_before_month(year, month) + day;
357 weekday(int year, int month, int day)
359 return (ymd_to_ord(year, month, day) + 6) % 7;
401 check_date_args(int year, int month, int day)
408 if (month < 1 || month > 12) {
410 "month must be in 1..12");
413 if (day < 1 || day > days_in_month(year, month)) {
415 "day is out of range for month");
515 int dim; /* # of days in month */
517 /* In actual use, m is always the month component extracted from a
530 /* Move day-1 days from the first of the month. First try to
580 normalize_date(int *year, int *month, int *day)
582 return normalize_y_m_d(year, month, day);
589 normalize_datetime(int *year, int *month, int *day,
597 return normalize_date(year, month, day);
672 new_date_ex(int year, int month, int day, PyTypeObject *type)
676 if (check_date_args(year, month, day) < 0) {
682 set_date_fields(self, year, month, day);
686 #define new_date(year, month, day) \
687 new_date_ex(year, month, day, &PyDateTime_DateType)
691 new_datetime_ex2(int year, int month, int day, int hour, int minute,
697 if (check_date_args(year, month, day) < 0) {
710 set_date_fields((PyDateTime_Date *)self, year, month, day);
725 new_datetime_ex(int year, int month, int day, int hour, int minute,
728 return new_datetime_ex2(year, month, day, hour, minute, second, usecond,
2488 {"month", (getter)date_month},
2495 static char *date_kws[] = {"year", "month", "day", NULL};
2503 int month;
2524 &year, &month, &day)) {
2525 self = new_date_ex(year, month, day, type);
2599 int month;
2606 ord_to_ymd(ordinal, &year, &month, &day);
2608 year, month, day);
2626 int month = GET_MONTH(date);
2631 if (normalize_date(&year, &month, &day) >= 0)
2632 result = new_date(year, month, day);
2824 int month = GET_MONTH(self);
2828 &year, &month, &day))
2830 tuple = Py_BuildValue("iii", year, month, day);
2952 PyDoc_STR("date(year, month, day) --> date object");
3766 1900, 1, 1, /* year, month, day */
4075 /* Accessor properties. Properties for day, month, and year are inherited
4132 "year", "month", "day", "hour", "minute", "second",
4142 int month;
4193 &year, &month, &day, &hour, &minute,
4195 self = new_datetime_ex2(year, month, day,
4213 utc_to_seconds(int year, int month, int day,
4224 ordinal = ymd_to_ord(year, month, day);
4259 int year, month, day, hour, minute, second, fold = 0;
4265 month = tm.tm_mon + 1;
4281 result_seconds = utc_to_seconds(year, month, day,
4296 return new_datetime_ex2(year, month, day, hour,
4527 int month = GET_MONTH(date);
4536 if (normalize_datetime(&year, &month, &day,
4541 return new_datetime(year, month, day,
5131 local_to_seconds(int year, int month, int day,
5272 local_to_seconds(int year, int month, int day,
5276 t = utc_to_seconds(year, month, day, hour, minute, second);
5496 PyDoc_STR("Return date object with same year, month and day.")},
5550 PyDoc_STR("datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])\n\
5552 The year, month and day arguments are required. tzinfo may be None, or an\n\