Formats a CarbonDate::Date with year precision as a string
 Returns:
 A human-readable string representing the Date
767834
def year(date)
      y = date.year.abs.to_s
      return [y, BCE_SUFFIX].join(' ') if (date.year <= -1)
      y
    end
1291964
def date_to_long_string(date, lang = lang)
      local_date_string(date, Localization::DATE_FMT_LONG[lang], lang)
    end
1274678
private static String formatDate(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss'Z'");
        formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
        return formatter.format(date);
    }
905692
function formatYear(year) {
    var from, to;

    year = year.split('–');

    if (year.length === 2) {
        from = +year[0];

        if (year[1]) {
            to = +year[1];
        }

        return { from: from, to: to };
    }

    return +year;
}
690755
public function getStepIndexFromDate(Carbon $date)
    {
        switch ($this->step) {
            case "yearly":
                $date->month = 1;
            case "monthly":
                $date->day = 1;
            case "daily":
                $date->hour = 0;
            case "hourly":
                $date->minute = 0;
            default:
                $date->second = 0;
                break;
        }

        return $date->format($this->getStepFormat());
    }
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)
  }
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;
	}
638206
public String format(Date date) {
		Calendar cal = new GregorianCalendar();
		cal.setTime(date);
		return DatatypeConverter.printDateTime(cal);
	}
1027856
def format_cftime_datetime(date):
    
    return '{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}.{:06d}'.format(
        date.year, date.month, date.day, date.hour, date.minute, date.second,
        date.microsecond)
268749
def date(date):
    
    date = date.value
    return (datetime.strptime(date[:-5], '%Y-%m-%dT%H:%M:%S')
            if len(date) == 24
            else datetime.strptime(date, '%Y%m%dT%H:%M:%S'))
211883
private String formatSecondaryDate(@NonNull Calendar date) {
        if(secondaryDateFormat == null)
            return DateUtils.formatDateTime(getContext(), date.getTimeInMillis(),
                    DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NUMERIC_DATE);
        else
            return secondaryDateFormat.format(date.getTime());
    }
1170042
private String zGetStandardTextFieldDateString(LocalDate date) {
        if (settings == null) {
            return "";
        }
        String standardDateString = "";
        if (date == null) {
            return standardDateString;
        }
        if (date.getEra() == IsoEra.CE) {
            standardDateString = date.format(settings.getFormatForDatesCommonEra());
        } else {
            standardDateString = date.format(settings.getFormatForDatesBeforeCommonEra());
        }
        return standardDateString;
    }
1035950
def asdate(self):
    
    return datetime.date(self.year, self.month, self.day)
162532
def _FormatDate(self, event):
    
    # TODO: preserve dfdatetime as an object.
    # TODO: add support for self._output_mediator.timezone
    date_time = dfdatetime_posix_time.PosixTimeInMicroseconds(
        timestamp=event.timestamp)

    year, month, day_of_month = date_time.GetDate()
    try:
      return '{0:04d}-{1:02d}-{2:02d}'.format(year, month, day_of_month)
    except (TypeError, ValueError):
      self._ReportEventError(event, (
          'unable to copy timestamp: {0!s} to a human readable date. '
          'Defaulting to: "0000-00-00"').format(event.timestamp))

      return '0000-00-00'
1297225
public static String dateToString(Date date) {
        GregorianCalendar c = new GregorianCalendar(GMT);
        c.setTime(date);
        String s = calendarToString(c);
        assert s.endsWith("+00:00");
        return s.substring(0, s.length() - 6) + "-00:00";
    }
300162
public static String formatDate(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat(TIMESTAMP_FORMAT);
        return formatter.format(date);
    }
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