Returns a term for the datetime.date object given.
515092
def get_term_by_date(date):
    
    year = date.year

    term = None
    for quarter in ('autumn', 'summer', 'spring', 'winter'):
        term = get_term_by_year_and_quarter(year, quarter)

        if date >= term.first_day_quarter:
            break

    # If we're in a year, before the start of winter quarter, we need to go
    # to the previous year's autumn term:
    if date < term.first_day_quarter:
        term = get_term_by_year_and_quarter(year - 1, 'autumn')

    # Autumn quarter should always last through the end of the year,
    # with winter of the next year starting in January.  But this makes sure
    # we catch it if not.
    term_after = get_term_after(term)
    if term_after.first_day_quarter > date:
        return term
    else:
        return term_after

    pass
33356
def getDate():
    """"""

    _ltime = _time.localtime(_time.time())
    date_str = _time.strftime('%Y-%m-%dT%H:%M:%S',_ltime)

    return date_str
455554
def _parse_date(cls, date_str: str) -> Optional[datetime.datetime]:
        """"""
        if not date_str:
            return None

        found_time = False
        found_day = False
        found_month = False
        found_year = False

        hour = minute = second = 0
        day = 0
        month = 0
        year = 0

        for token_match in cls.DATE_TOKENS_RE.finditer(date_str):

            token = token_match.group("token")

            if not found_time:
                time_match = cls.DATE_HMS_TIME_RE.match(token)
                if time_match:
                    found_time = True
                    hour, minute, second = [
                        int(s) for s in time_match.groups()]
                    continue

            if not found_day:
                day_match = cls.DATE_DAY_OF_MONTH_RE.match(token)
                if day_match:
                    found_day = True
                    day = int(day_match.group())
                    continue

            if not found_month:
                month_match = cls.DATE_MONTH_RE.match(token)
                if month_match:
                    found_month = True
                    month = month_match.lastindex
                    continue

            if not found_year:
                year_match = cls.DATE_YEAR_RE.match(token)
                if year_match:
                    found_year = True
                    year = int(year_match.group())

        if 70 <= year <= 99:
            year += 1900
        elif 0 <= year <= 69:
            year += 2000

        if False in (found_day, found_month, found_year, found_time):
            return None

        if not 1 <= day <= 31:
            return None

        if year < 1601 or hour > 23 or minute > 59 or second > 59:
            return None

        return datetime.datetime(year, month, day,
                                 hour, minute, second,
                                 tzinfo=datetime.timezone.utc)
20465
def get_datetext(year, month, day):
    """'"""
    input_format = "%Y-%m-%d"
    try:
        datestruct = time.strptime("%i-%i-%i" % (year, month, day),
                                   input_format)
        return strftime(datetext_format, datestruct)
    except:
        return datetext_default
955416
def date_time_string(self, timestamp=None):
        """"""
        if timestamp is None:
            timestamp = time.time()
        year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
        s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
                self.weekdayname[wd],
                day, self.monthname[month], year,
                hh, mm, ss)
        return s
689169
def datetime(self):
        """"""
        return dt.datetime(
            self.year(), self.month(), self.day(),
            self.hour(), self.minute(), self.second(),
            int(self.millisecond() * 1e3))
1015643
public static DateTime of(Date date) {
		if (date instanceof DateTime) {
			return (DateTime) date;
		}
		return new DateTime(date);
	}
1356205
def inc_date(date_obj, num, date_fmt):
    
    return (date_obj + timedelta(days=num)).strftime(date_fmt)
84625
def date(self, value=None):
        
        if not (value is None):
            if (self.metadatatype == "native"):
                self.metadata['date'] = value
            else:
                self._date = value
        if (self.metadatatype == "native"):
            if 'date' in self.metadata:
                return self.metadata['date']
            else:
                return None
        else:
            return self._date
800708
def extractDate(self, inp):
        """"""
        dates = self.extractDates(inp)
        for date in dates:
            return date
        return None
771483
def get_just_date(self):
        
        return datetime.datetime(
            self.date_time.year,
            self.date_time.month,
            self.date_time.day
        )
309408
def from_date(cls, date):
        
        try:
            date = date.date()
        except AttributeError:
            pass
        return cls(date.year, date.month)
374401
def get_dates(self):
        """"""
        if 'dates' in self.xml:
            if isinstance(self.xml['dates']['date'], dict):
                return self.xml['dates']['date'].values()[0]
            return self.xml['dates']['date']
        return None
61812
def to_ts(date: datetime.date) -> float:
    
    return datetime.datetime(
        date.year, date.month, date.day,
        tzinfo=datetime.timezone.utc).timestamp()
520581
def datetimes(self):
        """"""
        if self._timestamps_data is None:
            self._calculate_timestamps()
        return tuple(DateTime.from_moy(moy, self.is_leap_year)
                     for moy in self._timestamps_data)
521178
def date(self):
        ''' 
        '''
        utcnow = datetime.utcnow()
        return (utcnow + timedelta(hours=self.time_zone)).date()
88042
def t(self):
    "'"
    return u'%02d' % calendar.monthrange(self.data.year, self.data.month)[1]