Create easy to read date format.
519944
function getDisplayDate(date) {
        var monthStrings = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

        date = new Date(date);

        var hours = date.getHours();
        if (hours < 10) {
            hours = "0" + hours.toString();
        }
        var mins = date.getMinutes();
        if (mins < 10) {
            mins = "0" + mins.toString();
        }

        return monthStrings[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear() +
            " - " + hours + ":" + mins + " " + (date.getUTCHours() < 12 ? "AM" : "PM");
    }
425431
def parse_date(self, value):
        """"""
        res = dateparser.parse(
            value, date_formats=self.options['date_formats'], languages=self.options['languages']
        )
        logger.debug("result of date parsing=%s", res)
        return res
813019
def select_simple_date(date_input, value, format = nil)
      value = value.strftime format unless format.nil?

      date_input.set "#{value}\e"
    end
342590
def clean(self, text, guess=True, format=None, **kwargs):
        """"""
        # handle date/datetime before converting to text.
        date = self._clean_datetime(text)
        if date is not None:
            return date

        text = stringify(text)
        if text is None:
            return

        if format is not None:
            # parse with a specified format
            try:
                obj = datetime.strptime(text, format)
                return obj.date().isoformat()
            except Exception:
                return None

        if guess and not self.validate(text):
            # use dateparser to guess the format
            obj = self.fuzzy_date_parser(text)
            if obj is not None:
                return obj.date().isoformat()

        return self._clean_text(text)
1356774
def simple(self):
        ''''''
        if self._days:
            return '%sD' % self.totaldays
        elif self.months:
            return '%sM' % self._months
        elif self.years:
            return '%sY' % self.years
        else:
            return ''
299362
function datePrettyFormat(ms, opts) {
  if (typeof ms !== 'number') {
    throw new TypeError('Expected a number');
  }

  if (ms < 1000) {
    return Math.ceil(ms) + 'ms';
  }

  opts = opts || {};

  var secDecimalDigits = typeof opts.secDecimalDigits === 'number' ? opts.secDecimalDigits : 1;
  var ret = [];
  var parsed = formatDate(ms);

  ret = add(ret, parsed.years, 'y');
  ret = add(ret, parsed.days, 'd');
  ret = add(ret, parsed.hours, 'h');
  ret = add(ret, parsed.minutes, 'm');

  if (opts.compact) {
    ret = add(ret, parsed.seconds, 's');
    return '~' + ret[0];
  }

  ret = add(ret, (ms / 1000 % 60).toFixed(secDecimalDigits).replace(/\.0$/, ''), 's');

  return ret.join(' ');
}
483230
def convert_date(date):
    """"""
    date = convert_month(date, shorten=False)
    clean_string = convert_string(date)
    return datetime.strptime(clean_string, DATE_FMT.replace('-',''))
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')
241559
function defaultLongDateFormatter(date) {
        // Example: 'Thursday June 18 2015'
        return [
          service.days[date.getDay()],
          service.months[date.getMonth()],
          service.dates[date.getDate()],
          date.getFullYear()
        ].join(' ');
      }
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
132337
private String formatDate(Date date) {

        if (null == m_dateFormat) {
            m_dateFormat = DateFormat.getDateInstance(
                0,
                OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()));
        }
        return m_dateFormat.format(date);
    }
1273616
def _format(self, format):
        

        format = format.replace('%Y', '0000')
        # Year 0 is 1BC and a leap year. Leap years repeat themselves
        # every 28 years. Because of adjustments and the proleptic gregorian
        # calendar, the simplest way to format is to substitute year 2000.
        temp = datetime(
            2000,
            self.month,
            self.day,
            self.hour,
            self.minute,
            self.second,
            self.microsecond,
            self.tzinfo
        )
        if '%c' in format:
            c_out = temp.strftime('%c')
            # Handle full years
            c_out = c_out.replace('2000', '0000')
            c_out = c_out.replace('%', '%%')
            format = format.replace('%c', c_out)
        if '%x' in format:
            x_out = temp.strftime('%x')
            # Handle formats such as 08/16/2000 or 16.08.2000
            x_out = x_out.replace('2000', '0000')
            x_out = x_out.replace('%', '%%')
            format = format.replace('%x', x_out)
        return temp.strftime(format)
351862
def merge_datetime(date, time='', date_format='%d/%m/%Y', time_format='%H:%M'):
    """"""
    day = datetime.strptime(date, date_format)
    if time:
        time = datetime.strptime(time, time_format)
        time = datetime.time(time)
        day = datetime.date(day)
        day = datetime.combine(day, time)
    return day
890367
private void sampleFormatDateTime() {
        List<String> text = new ArrayList<String>();
        DateTime now = DateTime.now();
        text.add("Show time: " + DateUtils.formatDateTime(this, now, DateUtils.FORMAT_SHOW_TIME));
        text.add("Show date: " + DateUtils.formatDateTime(this, now, DateUtils.FORMAT_SHOW_DATE));
        text.add("Numeric date: " + DateUtils.formatDateTime(this, now, DateUtils.FORMAT_NUMERIC_DATE));
        text.add("Show date (abbreviated): " + DateUtils.formatDateTime(this, now, DateUtils.FORMAT_SHOW_DATE
            | DateUtils.FORMAT_ABBREV_ALL));
        text.add("Show date and time: " + DateUtils.formatDateTime(this, now, DateUtils.FORMAT_SHOW_DATE
            | DateUtils.FORMAT_SHOW_TIME));
        text.add("Show date (force year): " + DateUtils.formatDateTime(this, now, DateUtils.FORMAT_SHOW_DATE
            | DateUtils.FORMAT_SHOW_YEAR));
        addSample("DateUtils.formatDateTime()", text);
    }
149048
public static String formatDate(Date date, String mask) {
        if (date == null) {
            return "";
        }

        if (mask == null) {
            mask = DATE_FORMAT;
        }

        return new SimpleDateFormat(mask).format(date);
    }
249497
def normalize_date_format(date_str, default_time="00:00:00"):
    """"""
    ret_code, ret_data = check_date_str_format(date_str, default_time)
    if ret_code != RET_OK:
        return ret_code, ret_data

    return RET_OK, ret_data.strftime("%Y-%m-%d %H:%M:%S")
274783
def _parse_date(self, cell_value):
    """"""
    date_tuple = xlrd.xldate_as_tuple(cell_value, self.raw_sheet.book.datemode)
    return self.tuple_to_datetime(date_tuple)