Generate domain date in format <code>'yyyy-MM'</code>.

@param domainDate
the domain date
@return generated domain date in format <code>'yyyy-MM'</code>; e.g. <code>'2010-04'</code>
7641
public static String generateDomainDate(final Date domainDate) {
        if (domainDate == null) {
            throw new SwidException("domainDate isn't defined");
        }

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
        return dateFormat.format(domainDate);
    }
336065
public static PlainDate from(GregorianDate date) {

        if (date instanceof PlainDate) {
            return (PlainDate) date;
        } else {
            return PlainDate.of(date.getYear(), date.getMonth(), date.getDayOfMonth());
        }

    }
819855
public static String formatDate(Date d) {
    return d.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().toString();
  }
1348180
public static List<Fodselsnummer> getManyDNumberFodselsnummerForDate(Date date) {
		if (date == null) {
			throw new IllegalArgumentException();
		}
		DateFormat df = new SimpleDateFormat("ddMMyy");
		String centuryString = getCentury(date);
		String dateString = df.format(date);
		dateString = new StringBuilder()
				.append(Character.toChars(dateString.charAt(0) + 4)[0])
				.append(dateString.substring(1))
				.toString();
		return generateFodselsnummerForDate(dateString, centuryString);
	}
864499
@Deprecated
	public static String getDateString(Date date) {
		synchronized(StringUtility.class) {
			calendar.setTime(date);
			int day=calendar.get(Calendar.DATE);
			return (day>=0 && day<=9 ? "0":"")+String.valueOf(calendar.get(Calendar.DATE))+MONTHS[calendar.get(Calendar.MONTH)]+calendar.get(Calendar.YEAR);
		}
	}
716611
public static java.sql.Date getDateMMDDYYYY(String date) throws NumberFormatException, IllegalArgumentException {
		synchronized(StringUtility.class) {
			int len = date.length();
			if (len == 0) return null;
			if (len != 8) throw new IllegalArgumentException("Date must be in MMDDYYYY format: " + date);
			return new java.sql.Date(
				new GregorianCalendar(
					Integer.parseInt(date.substring(4, 8)),
					Integer.parseInt(date.substring(0, 2))-1,
					Integer.parseInt(date.substring(2, 4))
				).getTime().getTime()
			);
		}
	}
176745
public static String getDateTimeStrStandard(Date d) {
        if (d == null)
            return "";

        if (d.getTime() == 0L)
            return "Never";

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss.SSSZ");

        return sdf.format(d);
    }
839815
public static String convertDateToDateString(Date date) {
		if (date == null) {
			return null;
		} else {
			// DateFormat df = new SimpleDateFormat("yyyy-MM-dd'Z'");
			DateTimeFormatter df = FORMATTER_DATE_Z;
			return df.print(date.getTime());
		}
	}
132337
private String formatDate(Date date) {

        if (null == m_dateFormat) {
            m_dateFormat = DateFormat.getDateInstance(
                0,
                OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()));
        }
        return m_dateFormat.format(date);
    }
1017224
public String formatDate(Date date, int type)
    {
        String string = null;
        if (type == DBConstants.DATE_TIME_FORMAT)
            string = XmlUtilities.dateTimeFormat.format(date);
        else if (type == DBConstants.DATE_ONLY_FORMAT)
            string = XmlUtilities.dateFormat.format(date);
        else if (type == DBConstants.TIME_ONLY_FORMAT)
            string = XmlUtilities.timeFormat.format(date);
        return string;
    }
104826
public static String getDateTimeStr(Date d) {
        if (d == null)
            return "";

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
        // 20140315 test will problem +0000
        return sdf.format(d);
    }
1349731
public static Date parseDate(final String date) throws WarcFormatException {
		try {
			synchronized (W3C_ISO8601_DATE_PARSE) {
				return W3C_ISO8601_DATE_PARSE.parse(date);
			}
		} catch (ParseException e) {
			throw new WarcFormatException("Error parsing date " + date, e);
		}
	}
102185
public static String format(Date date) {
    Calendar calendar = new GregorianCalendar(TIMEZONE_Z, Locale.US);
    calendar.setTime(date);

    // estimate capacity of buffer as close as we can (yeah, that's pedantic ;)
    int capacity = "yyyy-MM-ddThh:mm:ss.sssZ".length();
    StringBuilder formatted = new StringBuilder(capacity);
    padInt(formatted, calendar.get(Calendar.YEAR), "yyyy".length());
    formatted.append('-');
    padInt(formatted, calendar.get(Calendar.MONTH) + 1, "MM".length());
    formatted.append('-');
    padInt(formatted, calendar.get(Calendar.DAY_OF_MONTH), "dd".length());
    formatted.append('T');
    padInt(formatted, calendar.get(Calendar.HOUR_OF_DAY), "hh".length());
    formatted.append(':');
    padInt(formatted, calendar.get(Calendar.MINUTE), "mm".length());
    formatted.append(':');
    padInt(formatted, calendar.get(Calendar.SECOND), "ss".length());
    formatted.append('.');
    padInt(formatted, calendar.get(Calendar.MILLISECOND), "sss".length());
    formatted.append('Z');
    return formatted.toString();
  }
1055556
public static DateTime date(Date date) {
		if (date instanceof DateTime) {
			return (DateTime) date;
		}
		return dateNew(date);
	}
1079515
public String doFormatDate(long date) {
        buf.setLength(0);
        gc.setTimeInMillis(date);

        int day_of_week = gc.get(Calendar.DAY_OF_WEEK);
        int day_of_month = gc.get(Calendar.DAY_OF_MONTH);
        int month = gc.get(Calendar.MONTH);
        int year = gc.get(Calendar.YEAR);
        int century = year / 100;
        year = year % 100;

        int hours = gc.get(Calendar.HOUR_OF_DAY);
        int minutes = gc.get(Calendar.MINUTE);
        int seconds = gc.get(Calendar.SECOND);

        buf.append(DAYS[day_of_week]);
        buf.append(',');
        buf.append(' ');
        StringUtils.append2digits(buf, day_of_month);

        buf.append(' ');
        buf.append(MONTHS[month]);
        buf.append(' ');
        StringUtils.append2digits(buf, century);
        StringUtils.append2digits(buf, year);

        buf.append(' ');
        StringUtils.append2digits(buf, hours);
        buf.append(':');
        StringUtils.append2digits(buf, minutes);
        buf.append(':');
        StringUtils.append2digits(buf, seconds);
        buf.append(" GMT");
        return buf.toString();
    }
642738
public static String getFormatDate(String format, Date date) {
        return getFormatDate(format, date, ZoneId.systemDefault().getId());
    }
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());
    }