Vocabulary of date intervals to calculate the "To" field date based
        from the "From" field date.
331328
def getInterval(self):
        
        items = (
            ("", _(u"Not set")),
            ("1", _(u"daily")),
            ("7", _(u"weekly")),
            ("30", _(u"monthly")),
            ("90", _(u"quarterly")),
            ("180", _(u"biannually")),
            ("365", _(u"yearly")),
        )
        return DisplayList(items)
44012
def trigger_to_dict(trigger):
    """"""

    data = OrderedDict()

    if isinstance(trigger, DateTrigger):
        data['trigger'] = 'date'
        data['run_date'] = trigger.run_date
    elif isinstance(trigger, IntervalTrigger):
        data['trigger'] = 'interval'
        data['start_date'] = trigger.start_date

        if trigger.end_date:
            data['end_date'] = trigger.end_date

        w, d, hh, mm, ss = extract_timedelta(trigger.interval)

        if w > 0:
            data['weeks'] = w
        if d > 0:
            data['days'] = d
        if hh > 0:
            data['hours'] = hh
        if mm > 0:
            data['minutes'] = mm
        if ss > 0:
            data['seconds'] = ss
    elif isinstance(trigger, CronTrigger):
        data['trigger'] = 'cron'

        if trigger.start_date:
            data['start_date'] = trigger.start_date

        if trigger.end_date:
            data['end_date'] = trigger.end_date

        for field in trigger.fields:
            if not field.is_default:
                data[field.name] = str(field)
    else:
        data['trigger'] = str(trigger)

    return data
346927
function (date, tpl) {
    this.tpl = tpl;
    this.f  = {
        y: date.getYear() + 1900,
        m: date.getMonth() + 1,
        d: date.getDate(),
        H: date.getHours(),
        M: date.getMinutes(),
        S: date.getSeconds()
    };
}
432752
def calculate_date_strings(self, mode, numDays):
        """"""

        yesterday = date.today() - timedelta(days=1)
        endday = datetime(yesterday.year, yesterday.month, yesterday.day, 23, 59, 59, 999)
        if mode:
            startday = yesterday - timedelta(days=numDays)
        else:
            # daily mode
            startday = yesterday

        return startday.isoformat(), endday.strftime('%Y-%m-%d %H:%M:%S.%f')
686756
def getDateFields(fc):
    
    if arcpyFound == False:
        raise Exception("ArcPy is required to use this function")
    return [field.name for field in arcpy.ListFields(fc, field_type="Date")]
585695
def add_ago_to_since(since: str) -> str:
    
    since_words = since.split(' ')
    grains = ['days', 'years', 'hours', 'day', 'year', 'weeks']
    if (len(since_words) == 2 and since_words[1] in grains):
        since += ' ago'
    return since
561358
def get_dates(schema):
    """"""
    dates = [config.LAST_UPDATED, config.DATE_CREATED]
    for field, field_schema in schema.items():
        if field_schema['type'] == 'datetime':
            dates.append(field)
    return dates
1248471
def subset(self, fromdate, todate):
        '''
        
        '''
#CONSIDER: raise an exception if a date is not in self
        i_from = self.index(fromdate)
        if fromdate != self[i_from]:
            # don't go back before fromdate
            i_from += 1
        i_to = self.index(todate)
        return self[i_from:i_to + 1]
1315255
def t_DATE(t):
    '
    day = int(t.lexer.lexmatch.group('day'))
    month = int(t.lexer.lexmatch.group('month'))
    year = int(t.lexer.lexmatch.group('year'))
    t.value = date(year, month, day)
    return t
906310
def QA_util_getBetweenMonth(from_date, to_date):
    
    date_list = {}
    begin_date = datetime.datetime.strptime(from_date, "%Y-%m-%d")
    end_date = datetime.datetime.strptime(to_date, "%Y-%m-%d")
    while begin_date <= end_date:
        date_str = begin_date.strftime("%Y-%m")
        date_list[date_str] = ['%d-%d-01' % (begin_date.year, begin_date.month),
                               '%d-%d-%d' % (begin_date.year, begin_date.month,
                                             calendar.monthrange(begin_date.year, begin_date.month)[1])]
        begin_date = QA_util_get_1st_of_next_month(begin_date)
    return(date_list)
688334
def semantic_date_range_tag(date_from, date_to, options = {})
      SemanticDateTimeTags::Tag::DateRange.new(date_from, date_to, options).to_html
    end
874200
def quarter_to_daterange(quarter):
    """"""
    assert len(quarter) == 6
    year = int(quarter[0:4])
    quarter = quarter[5]
    MONTH_DAY = {
        '1': ((1, 1), (3, 31)),
        '2': ((4, 1), (6, 30)),
        '3': ((7, 1), (9, 30)),
        '4': ((10, 1), (12, 31))
    }
    md = MONTH_DAY[quarter]
    start_md, end_md = md
    return (
        date(year, *start_md),
        date(year, *end_md)
    )
388689
def time_context_from_timex(timex):
    """"""
    time_text = timex.get('text')
    constraint = timex['intervals'][0]
    start = _get_time_stamp(constraint.get('start'))
    end = _get_time_stamp(constraint.get('end'))
    duration = constraint['duration']
    tc = TimeContext(text=time_text, start=start, end=end,
                     duration=duration)
    return tc
655178
public String describeDayOfWeek(final Map<CronFieldName, CronField> fields, final Map<CronFieldName, FieldDefinition> definitions) {

        final String description = DescriptionStrategyFactory.daysOfWeekInstance(
                resourceBundle,
                fields.containsKey(CronFieldName.DAY_OF_WEEK) ? fields.get(CronFieldName.DAY_OF_WEEK).getExpression() : null,
                definitions.containsKey(CronFieldName.DAY_OF_WEEK) ? definitions.get(CronFieldName.DAY_OF_WEEK) : null
        ).describe();
        return addExpressions(description, resourceBundle.getString("day"), resourceBundle.getString("days"));
    }
1051086
def circa(str)
      run = str.gsub!(/.*c[irca\.]*/i, '')
      run ||= str.gsub!(/.*about/i, '')
      date = parse(str) if run

      return nil if date.nil?

      # The EDTF grammar does not support uncertainty on masked precision dates
      if date.respond_to? :uncertain!
        date.uncertain!
      elsif date.is_a? EDTF::Interval
        # Interval uncertainty is scoped to the begin and end dates;
        # to be safe, we mark both.
        date.from = date.from.uncertain! if date.from.respond_to? :uncertain!
        date.to   = date.to.uncertain!   if date.to.respond_to? :uncertain!
      end

      date
    end
892556
def date(options = {})
      non_relative_prefix = options[:non_relative_prefix] || "on "
      if interrogator.today?
        result = "today"
      elsif interrogator.yesterday?
        result = "yesterday"
      elsif interrogator.tomorrow?
        result = "tomorrow"
      elsif @context == :future && interrogator.next_x_days?(6)
        result = non_relative_prefix + name_of_day
      elsif @context == :future && interrogator.next_week?
        result = "next #{name_of_day}"
      elsif @context == :past && interrogator.last_x_days?(6)
        result = non_relative_prefix + name_of_day
      elsif @context == :past && interrogator.last_x_days?(12)
        result = "last #{name_of_day}"
      elsif @context == :past && interrogator.next_x_days?(6)
        result = "next #{name_of_day}"
      else
        result = non_relative_prefix + "#{name_of_day} #{day_of_month} #{name_of_month}"
        result += " #{@time.year}" if include_year_in_dates?
        result
      end

      unless options[:capitalize] == false
        result[0] = result[0].upcase
      end

      result
    end
1093445
def dates(self, field_name, kind, order='ASC'):
        

        assert kind in ("month", "year", "day", "week", "hour", "minute"), \
            "'kind' must be one of 'year', 'month', 'day', 'week', 'hour' and 'minute'."
        assert order in ('ASC', 'DESC'), \
            "'order' must be either 'ASC' or 'DESC'."

        search = self._build_search()
        search.facet.reset()
        search.facet.add_date_facet(name=field_name.replace("__", "."),
                                    field=field_name, interval=kind)
        search.size = 0
        connection = self.model._meta.dj_connection

        resulset = connection.connection.search(search, indices=connection.database, doc_types=self.type)
        resulset.fix_facets()
        entries = []
        for val in resulset.facets.get(field_name.replace("__", ".")).get("entries", []):
            if "time" in val:
                entries.append(val["time"])
        if order == "ASC":
            return sorted(entries)

        return sorted(entries, reverse=True)