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

@param time the time value to format as date
@return the formatted date
558210
public String getDate(long time) {

        return CmsDateUtil.getDate(new Date(time), DateFormat.SHORT, m_locale);
    }
726409
public String getDate(long time) {

        return CmsDateTimeUtil.getDate(new Date(time), CmsDateTimeUtil.Format.SHORT);
    }
1165276
public static Date strToTime(String time) throws ParseException {

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

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

        return d;
    }
433561
public static String getShortDateString(long time, String format) {
        if (format == null || format.isEmpty()) {
            format = "yyyy-MM-dd";
        }

        SimpleDateFormat smpf = new SimpleDateFormat(format);
        return smpf.format(new Date(time));
    }
157893
public static Date parseAWSDate(String date) {
		if (date == null) {
			return null;
		}
		return TIME_FORMATTER.parseDateTime(date).toDate();
	}
1151360
public static String elasticSearchTimeFormatToISO8601(String time) {
        try {
            DateTime dt = DateTime.parse(time, ES_DATE_FORMAT_FORMATTER);
            return getISO8601String(dt);
        } catch (IllegalArgumentException e) {
            return time;
        }
    }
1209134
private SimpleDateFormat getDateTimeFormatter() {
		SimpleDateFormat formatter = new SimpleDateFormat();
		formatter.applyPattern("yyyy-MM-dd'T'HH:mm:ss");
		formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
		return formatter;
	}
856055
public static String formatTimestamp(@Nullable Date date) {
        return (date != null) ? date.toInstant().toString() : null;
    }
1152407
public java.text.DateFormat getTimeFormat() {
        if(timeFormat == null)
            timeFormat = java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT);
        return timeFormat;
    }
11058
public static final Date parseTimestamp(String value)
   {
      Date result = null;

      if (value != null && value.length() != 0)
      {
         try
         {
            result = TIMESTAMP_FORMAT.get().parse(value);
         }

         catch (ParseException ex)
         {
            // Ignore parse exception
         }
      }

      return (result);
   }
563377
public static function shortTime($time)
    {
        if (self::isTime($time)) {
            $str = self::dateTimeToTimeStamp($time);
            $string = date("H:i", $str);
            return $string;
        } else {
            return null;
        }
    }
1029569
public static Timestamp getTimeStamp(String time) {
	if (time.equalsIgnoreCase("now")) {
	    return Timestamp.now();
	} else {
	    int quantity = 0;
	    String unit = "";
	    Pattern lastNUnitsPattern = Pattern
		    .compile(
			    "last\\s*(\\d*)\\s*(min|mins|hour|hours|day|days|week|weeks).*",
			    Pattern.CASE_INSENSITIVE);
	    Matcher lastNUnitsMatcher = lastNUnitsPattern.matcher(time);
	    while (lastNUnitsMatcher.find()) {
		quantity = "".equals(lastNUnitsMatcher.group(1)) ? 1 : Integer
			.valueOf(lastNUnitsMatcher.group(1));
		unit = lastNUnitsMatcher.group(2).toLowerCase();
		switch (unit) {
		case "min":
		case "mins":
		    return Timestamp.now().minus(
			    TimeDuration.ofMinutes(quantity));
		case "hour":
		case "hours":
		    return Timestamp.now()
			    .minus(TimeDuration.ofHours(quantity));
		case "day":
		case "days":
		    return Timestamp.now().minus(
			    TimeDuration.ofHours(quantity * 24));
		case "week":
		case "weeks":
		    return Timestamp.now().minus(
			    TimeDuration.ofHours(quantity * 24 * 7));
		default:
		    break;
		}
	    }

	    Pattern nUnitsAgoPattern = Pattern
		    .compile(
			    "(\\d*)\\s*(min|mins|hour|hours|day|days|week|weeks)\\s*ago",
			    Pattern.CASE_INSENSITIVE);
	    Matcher nUnitsAgoMatcher = nUnitsAgoPattern.matcher(time);
	    while (nUnitsAgoMatcher.find()) {
		quantity = "".equals(nUnitsAgoMatcher.group(1)) ? 1 : Integer
			.valueOf(nUnitsAgoMatcher.group(1));
		unit = nUnitsAgoMatcher.group(2).toLowerCase();
		switch (unit) {
		case "min":
		case "mins":
		    return Timestamp.now().minus(
			    TimeDuration.ofMinutes(quantity));

		case "hour":
		case "hours":
		    return Timestamp.now()
			    .minus(TimeDuration.ofHours(quantity));
		case "day":
		case "days":
		    return Timestamp.now().minus(
			    TimeDuration.ofHours(quantity * 24));
		case "week":
		case "weeks":
		    return Timestamp.now().minus(
			    TimeDuration.ofHours(quantity * 24 * 7));
		default:
		    break;
		}
	    }
	    TimestampFormat format = new TimestampFormat(
		    "yyyy-MM-dd'T'HH:mm:ss");
	    try {
		return format.parse(time);
	    } catch (ParseException e) {
		return null;
	    }
	}
    }
617674
public String format(Time pTime) {
	StringBuilder buf = new StringBuilder();
	for (int i = 0; i < formatter.length; i++) {
	    buf.append(formatter[i].format(pTime));
	}
	return buf.toString();
    }
907735
public static final Date parseDateTime(String value)
   {
      Date result = null;

      try
      {
         if (value != null && !value.isEmpty())
         {
            result = DATE_TIME_FORMAT.get().parse(value);
         }
      }
      catch (ParseException ex)
      {
         // Ignore
      }

      return result;
   }
168850
private String formatDate(Date value)
   {
      return (value == null ? null : m_formats.getDateFormat().format(value));
   }
1236385
static String formatTime() {
        Date date = new Date();
        DateFormat formatter = BaseTraceFormatter.useIsoDateFormat ? new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") : DateFormatProvider.getDateFormat();
        StringBuffer answer = new StringBuffer();
        answer.append('[');
        formatter.format(date, answer, new FieldPosition(0));
        answer.append(']');
        return answer.toString();
    }
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;

	}