Returns a formated date and time String from a Date value,
the format being {@link CmsDateTimeUtil.Format#SHORT} and the locale
based on this instance.<p>

@param date the Date object to format as String
@return the formatted date and time
161667
public String getDateTime(Date date) {

        return CmsDateTimeUtil.getDateTime(date, CmsDateTimeUtil.Format.SHORT);
    }
303003
@Override
    public String format(Date date, String mask) {
	DateTime dt = (date instanceof DateTime) ? (DateTime) date : new DateTimeImpl(date.getTime(), false);
	return format(dt, mask, null);
    }
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();
  }
615354
@Deprecated
	public static String getDateStringMMDDYYYY(Date date) {
		if(date==null) return "";
		Calendar C=Calendar.getInstance();
		C.setTime(date);
		int day=C.get(Calendar.DATE);
		int month=C.get(Calendar.MONTH)+1;
		return
			(month>=0 && month<=9 ? "0":"")
			+month
			+(day>=0 && day<=9 ? "0":"")
			+day
			+C.get(Calendar.YEAR)
		;
	}
1207162
public static String formatTime(Date date) {
		if (null == date) {
			return null;
		}
		return DatePattern.NORM_TIME_FORMAT.format(date);
	}
132337
private String formatDate(Date date) {

        if (null == m_dateFormat) {
            m_dateFormat = DateFormat.getDateInstance(
                0,
                OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()));
        }
        return m_dateFormat.format(date);
    }
1152407
public java.text.DateFormat getTimeFormat() {
        if(timeFormat == null)
            timeFormat = java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT);
        return timeFormat;
    }
120844
public static String formatDateTime(CmsObject cms, long date) {

        return CmsDateUtil.getDateTime(
            new Date(date),
            DateFormat.MEDIUM,
            OpenCms.getWorkplaceManager().getWorkplaceLocale(cms));
    }
236677
public static String format(final Date date, String format) {

		if (date != null) {

			if (StringUtils.isBlank(format)) {

				format = DateProperty.getDefaultFormat();

			}

			return new SimpleDateFormat(format).format(date);
		}

		return null;

	}
726409
public String getDate(long time) {

        return CmsDateTimeUtil.getDate(new Date(time), CmsDateTimeUtil.Format.SHORT);
    }
343664
public String getDate(Date date) {

        return CmsDateUtil.getDate(date, DateFormat.SHORT, m_locale);
    }
214830
public static String format(Date date, DatePrinter format) {
		if (null == format || null == date) {
			return null;
		}
		return format.format(date);
	}
558210
public String getDate(long time) {

        return CmsDateUtil.getDate(new Date(time), DateFormat.SHORT, m_locale);
    }
179247
public static Date parseDate(final String date) {

        /*
            IE9 sends a superflous lenght parameter after date in the
            If-Modified-Since header, which needs to be stripped before
            parsing.

         */

        final int semicolonIndex = date.indexOf(';');
        final String trimmedDate = semicolonIndex >= 0 ? date.substring(0, semicolonIndex) : date;

        ParsePosition pp = new ParsePosition(0);
        SimpleDateFormat dateFormat = RFC1123_PATTERN_FORMAT.get();
        dateFormat.setTimeZone(GMT_ZONE);
        Date val = dateFormat.parse(trimmedDate, pp);
        if (val != null && pp.getIndex() == trimmedDate.length()) {
            return val;
        }

        pp = new ParsePosition(0);
        dateFormat = new SimpleDateFormat(RFC1036_PATTERN, LOCALE_US);
        dateFormat.setTimeZone(GMT_ZONE);
        val = dateFormat.parse(trimmedDate, pp);
        if (val != null && pp.getIndex() == trimmedDate.length()) {
            return val;
        }

        pp = new ParsePosition(0);
        dateFormat = new SimpleDateFormat(ASCITIME_PATTERN, LOCALE_US);
        dateFormat.setTimeZone(GMT_ZONE);
        val = dateFormat.parse(trimmedDate, pp);
        if (val != null && pp.getIndex() == trimmedDate.length()) {
            return val;
        }

        pp = new ParsePosition(0);
        dateFormat = new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US);
        dateFormat.setTimeZone(GMT_ZONE);
        val = dateFormat.parse(trimmedDate, pp);
        if (val != null && pp.getIndex() == trimmedDate.length()) {
            return val;
        }

        return null;
    }
3991
public static String formatTime (Date date)
    {
        return (date == null) ? "" : _tfmt.format(date).toLowerCase();
    }
1357796
public static final synchronized Date parseDate(String date) {
		try {
			return dateFormat.parse(date);
		} catch(ParseException e) {
			throw new RuntimeException(e);
		}
	}
223143
static public String getDateAsString(
      Date date, SnowflakeDateTimeFormat dateFormatter)
  {
    return dateFormatter.format(date, timeZoneUTC);
  }