Convert from {@code Date} to AgMIP standard date string (YYYYMMDD)

@param date {@link Date} object

@return an AgMIP standard date string representation of {@code date}.
977107
public synchronized static String convertToAgmipDateString(Date date) {
        if (date != null) {
            return dateFormatter.format(date);
        } else {
            return null;
        }
    }
1241476
public static String format(Date date) {
        DateFormat dateFormat = new SimpleDateFormat(DateField.FORMAT);
        return date == null ? null : dateFormat.format(date);
    }
1057557
public static String toUTCString(Date date) {

    SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
    sd.setTimeZone(TimeZone.getTimeZone("GMT"));
    return sd.format(date);
  }
1181866
public static String toISO8601(Date date){
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US);
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        return dateFormat.format(date);
    }
127128
public static String dateToString(final Date date, final String format) {
        if (date == null) {
            return null;
        }
        final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
        return dateFormat.format(date);
    }
1164068
private String convertDate(String date) {
        SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
        try {
            Date creationDate = sdf.parse(date);
            sdf = new SimpleDateFormat("\\'yr'yyyy\\'mo'MM\\'dy'dd\\'hr'HH\\'min'mm\\'sec'ss");
            return sdf.format(creationDate);
        } catch(ParseException pe) {
            pe.printStackTrace();
            return "";
        }
    }
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);
    }
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()
			);
		}
	}
913927
public static Calendar toCalendar(final Date date) {
        final Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c;
    }
945253
public static String encodeDate(Date date) {
        SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
        /* Java doesn't handle ISO8601 nicely: need to add ':' manually */
        String result = dateFormatter.format(date);
        return result.substring(0, result.length() - 2) + ":" + result.substring(result.length() - 2);
    }
132337
private String formatDate(Date date) {

        if (null == m_dateFormat) {
            m_dateFormat = DateFormat.getDateInstance(
                0,
                OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()));
        }
        return m_dateFormat.format(date);
    }
331247
public static String formatISO8601Date(Date date) {
        try {
            return iso8601DateFormat.print(date.getTime());
        } catch(RuntimeException ex) {
            throw handleException(ex);
        }
    }
320992
public static XMLGregorianCalendar timeStamp(Date date) {
		GregorianCalendar gc = new GregorianCalendar();
		gc.setTime(date);
		return xmlDatatypeFactory.newXMLGregorianCalendar(gc);
	}
638980
public static String getDateTerms(long date) {

        Calendar cal = Calendar.getInstance(OpenCms.getLocaleManager().getTimeZone());
        cal.setTimeInMillis(date);
        String day = CmsSearchIndex.DATES[cal.get(5)];
        String month = CmsSearchIndex.DATES[(cal.get(2) + 1)];
        String year = String.valueOf(cal.get(1));

        StringBuffer result = new StringBuffer();
        result.append(year);
        result.append(month);
        result.append(day);
        result.append(' ');
        result.append(year);
        result.append(month);
        result.append(' ');
        result.append(year);
        return result.toString();
    }
358508
public static long toMJD(GregorianDate date) {

        return GregorianMath.toMJD(date.getYear(), date.getMonth(), date.getDayOfMonth());

    }
479734
public static Date strToDate(String date) throws ParseException {

        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");

        java.util.Date d = sdf.parse(date);

        return d;
    }
638206
public String format(Date date) {
		Calendar cal = new GregorianCalendar();
		cal.setTime(date);
		return DatatypeConverter.printDateTime(cal);
	}