Helper function for formatting dates.
483179
protected String date (int style, Object arg)
    {
        Date when = massageDate(arg);
        if (when == null) {
            return "<!" + arg + ">";
        }
        return DateFormat.getDateInstance(style, getLocale()).format(when);
    }
695344
function formatDate(date, format)
  {
    let parsedDate = new Date(date)
    if (!isDate(parsedDate))
      throw new TypeError("A date or timestamp must be provided to {{formatDate}}")

    if (isString(format) && format in formats.date)
      format = formats.date[format]

    return getCachedDateTimeFormat(locale, format).format(parsedDate)
  }
422864
def dateDict(date, prefix = ""):
    """"""
    res = {}

    res[prefix+"a"] = date.strftime("%a")
    res[prefix+"A"] = date.strftime("%A")
    res[prefix+"b"] = date.strftime("%b")
    res[prefix+"B"] = date.strftime("%B")
    res[prefix+"c"] = date.strftime("%c")
    res[prefix+"d"] = date.strftime("%d")
    res[prefix+"H"] = date.strftime("%H")
    res[prefix+"I"] = date.strftime("%I")
    res[prefix+"j"] = date.strftime("%j")
    res[prefix+"m"] = date.strftime("%m")
    res[prefix+"M"] = date.strftime("%M")
    res[prefix+"p"] = date.strftime("%p")
    res[prefix+"S"] = date.strftime("%S")
    res[prefix+"U"] = date.strftime("%U")
    res[prefix+"w"] = date.strftime("%w")
    res[prefix+"W"] = date.strftime("%W")
    res[prefix+"x"] = date.strftime("%x")
    res[prefix+"X"] = date.strftime("%X")
    res[prefix+"y"] = date.strftime("%y")
    res[prefix+"Y"] = date.strftime("%Y")
    res[prefix+"Z"] = date.strftime("%Z")

    for i, value in res.items():
        res[i] = locale_to_utf8(value)

    return res
895861
def format_items(x):
    """"""
    x = np.asarray(x)
    timedelta_format = 'datetime'
    if np.issubdtype(x.dtype, np.timedelta64):
        x = np.asarray(x, dtype='timedelta64[ns]')
        day_part = (x[~pd.isnull(x)]
                    .astype('timedelta64[D]')
                    .astype('timedelta64[ns]'))
        time_needed = x[~pd.isnull(x)] != day_part
        day_needed = day_part != np.timedelta64(0, 'ns')
        if np.logical_not(day_needed).all():
            timedelta_format = 'time'
        elif np.logical_not(time_needed).all():
            timedelta_format = 'date'

    formatted = [format_item(xi, timedelta_format) for xi in x]
    return formatted
361368
def _split_date(self, time):
        """"""
        if isinstance(time, str):
            month, day, year = [int(t) for t in re.split(r'-|/', time)]
            if year < 100:
                # Quick hack for dates < 2000.
                year += 2000
            time = date(year, month, day)
        return time.strftime('%Y-%m-%dT%H:%M:%SZ')
983585
def date_from_string(string, format_string=None):
    """"""

    if isinstance(format_string, str):
        return datetime.datetime.strptime(string, format_string).date()

    elif format_string is None:
        format_string = [
            "%Y-%m-%d",
            "%m-%d-%Y",
            "%m/%d/%Y",
            "%d/%m/%Y",
        ]

    for format in format_string:
        try:
            return datetime.datetime.strptime(string, format).date()
        except ValueError:
            continue

    raise ValueError("Could not produce date from string: {}".format(string))
1153096
def pretty_timestamp(timestamp, date_format='%a-%m_%d_%y:%H:%M:%S'):
    """"""
    return time.strftime(date_format,
                         time.localtime(int(str(timestamp)[:10])))
1047718
def _convert_date(self, date):
        """'"""
        return '/'.join([str(int(date.split('/')[0]) + 1911)] + date.split('/')[1:])
1067604
def _to_desired_dates(self, arr):
        """"""
        times = utils.times.extract_months(
            arr[internal_names.TIME_STR], self.months
        )
        return arr.sel(time=times)
812684
private String getFormattedDate(Date date) {
		String formattedDate = "";
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		try {
			formattedDate = ValueFactoryImpl.getInstance().createValue(cal).getString();
		} catch (Exception e) {
			// should never happen
			e.printStackTrace();
		}
		return formattedDate;
	}
581729
function formatDate(lang, input) {

	var result = input;
	var matches;
	var localeDateString;

	while ((matches = DATE_REGEX.exec(input)) != null) {

		var date = new Date(Date.parse(matches[1]));
		var format = matches[2] != undefined ? matches[2].toLowerCase() : "compact";

		if (format != "compact") {
			localeDateString = date.toLocaleDateString(lang,
				{
					day: "numeric",
					weekday: format,
					month: format,
					year: "numeric"
				});
		}
		else {
			localeDateString = date.toLocaleDateString();
		}
		result = result.replace(matches[0], localeDateString);
	};
	return result;

}
7647
def dateFormat(when):
    
    retval = ""
    if when is not None:
        dow = dateformat.format(when, "l")
        dom = dateformat.format(when, "jS")
        month = dateformat.format(when, "F")
        if when.year != dt.date.today().year:
            retval = _("{weekday} {day} of {month} {year}")  \
                    .format(weekday=dow, day=dom, month=month, year=when.year)
        else:
            retval = _("{weekday} {day} of {month}")  \
                    .format(weekday=dow, day=dom, month=month)
    return retval
219859
def _format_strings(self):
        

        values = self.values.astype(object)
        is_dates_only = _is_dates_only(values)
        formatter = (self.formatter or
                     _get_format_datetime64(is_dates_only,
                                            date_format=self.date_format))
        fmt_values = [formatter(x) for x in values]

        return fmt_values
1040608
function(format, date) {
		var self = this,
			output, d, dw, m, y, h, g, i, s;
		
		if (! date) {
			date = new Date();
		}
		
		h  = date[self.getHours]();
		g  = h > 12 ? h - 12 : h;
		i  = date[self.getMinutes]();
		s  = date[self.getSeconds]();
		d  = date[self.getDate]();
		dw = date[self.getDay]();
		m  = date[self.getMonth]() + 1;
		y  = date[self.getFullYear]();
		
		output = format.replace(/[a-z]/gi, function(val) {
			switch (val) {
				case 'd': return d > 9 ? d : '0'+d;
				case 'j': return d;
				case 'D': return self.i18n(self.i18.daysShort[dw]);
				case 'l': return self.i18n(self.i18.days[dw]);
				case 'm': return m > 9 ? m : '0'+m;
				case 'n': return m;
				case 'M': return self.i18n(self.i18.monthsShort[m-1]);
				case 'F': return self.i18n(self.i18.months[m-1]);
				case 'Y': return y;
				case 'y': return (''+y).substr(2);
				case 'H': return h > 9 ? h : '0'+h;
				case 'G': return h;
				case 'g': return g;
				case 'h': return g > 9 ? g : '0'+g;
				case 'a': return h >= 12 ? 'pm' : 'am';
				case 'A': return h >= 12 ? 'PM' : 'AM';
				case 'i': return i > 9 ? i : '0'+i;
				case 's': return s > 9 ? s : '0'+s;
			}
			return val;
		});
		
		return output;
	}
71814
def process_date_updated(self, text):
        """"""
        date = parse(text)
        if self.date_updated == 'N/A':
            self.date_updated = date
        if date > self.date_updated:
            self.date_updated = date
741095
def format_day(
        self, date: datetime.datetime, gmt_offset: int = 0, dow: bool = True
    ) -> bool:
        
        local_date = date - datetime.timedelta(minutes=gmt_offset)
        _ = self.translate
        if dow:
            return _("%(weekday)s, %(month_name)s %(day)s") % {
                "month_name": self._months[local_date.month - 1],
                "weekday": self._weekdays[local_date.weekday()],
                "day": str(local_date.day),
            }
        else:
            return _("%(month_name)s %(day)s") % {
                "month_name": self._months[local_date.month - 1],
                "day": str(local_date.day),
            }
168850
private String formatDate(Date value)
   {
      return (value == null ? null : m_formats.getDateFormat().format(value));
   }