Returns a string for given time.<p>

@param time as timestamp
@return string array containing string for hours, minutes, seconds
491124
public static String[] getHourMinuteSecondTimeString(long time) {

        int hours = (int)time / (1000 * 60 * 60);
        int min = (int)(time - (hours * 1000 * 60 * 60)) / (1000 * 60);
        int sec = (int)(time - (hours * 1000 * 60 * 60) - (min * 1000 * 60)) / 1000;

        return new String[] {getTwoDigitsString(hours), getTwoDigitsString(min), getTwoDigitsString(sec)};
    }
840043
public static String toTimeString(java.util.Date date) {
		if (date == null)
			return "";
		Calendar calendar = Calendar.getInstance();

		calendar.setTime(date);
		return (toTimeString(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND)));
	}
1322680
public String toTimeStr() {
		if (null != this.timeZone) {
			final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatePattern.NORM_TIME_PATTERN);
			simpleDateFormat.setTimeZone(this.timeZone);
			return toString(simpleDateFormat);
		}
		return toString(DatePattern.NORM_TIME_FORMAT);
	}
1334399
public String timeToString(java.util.Date time, boolean withTimeZone) {
    Calendar cal = null;
    if (withTimeZone) {
      cal = calendarWithUserTz;
      cal.setTimeZone(timeZoneProvider.get());
    }
    if (time instanceof Timestamp) {
      return toString(cal, (Timestamp) time, withTimeZone);
    }
    if (time instanceof Time) {
      return toString(cal, (Time) time, withTimeZone);
    }
    return toString(cal, (Date) time, withTimeZone);
  }
188077
public static final synchronized Date parseTime(String time) {
		try {
			return timeFormat.parse(time);
		} catch(ParseException e) {
			throw new RuntimeException(e);
		}
	}
862547
private static String time2Str(long elapsedTime) {
    String unit;
    double time = elapsedTime;
    if (elapsedTime < 1000) {
      unit = "milliseconds";
    } else if (elapsedTime < 60*1000) {
      unit = "seconds";
      time = time/1000;
    } else if (elapsedTime < 3600*1000) {
      unit = "minutes";
      time = time/(60*1000);
    } else {
      unit = "hours";
      time = time/(3600*1000);
    }

    return time+" "+unit;
  }
563377
public static function shortTime($time)
    {
        if (self::isTime($time)) {
            $str = self::dateTimeToTimeStamp($time);
            $string = date("H:i", $str);
            return $string;
        } else {
            return null;
        }
    }
623209
public function dateString(string $time): string
    {
        return date($this->dateFormat, ctype_digit($time) ? $time : strtotime($time));
    }
390863
public static synchronized String getTime(Date date) {
		if (date == null) {
			return null;
		}
		return GET_TIME_FORMAT.format(date);
	}
89749
public static long parseTimeString( String time ) {
        String trimmed = time.trim();
        long result = 0;
        if( trimmed.length() > 0 ) {
            Matcher mat = SIMPLE.matcher( trimmed );
            if ( mat.matches() ) {
                int days = (mat.group( SIM_DAY ) != null) ? Integer.parseInt( mat.group( SIM_DAY ) ) : 0;
                int hours = (mat.group( SIM_HOU ) != null) ? Integer.parseInt( mat.group( SIM_HOU ) ) : 0;
                int min = (mat.group( SIM_MIN ) != null) ? Integer.parseInt( mat.group( SIM_MIN ) ) : 0;
                int sec = (mat.group( SIM_SEC ) != null) ? Integer.parseInt( mat.group( SIM_SEC ) ) : 0;
                int ms = (mat.group( SIM_MS ) != null) ? Integer.parseInt( mat.group( SIM_MS ) ) : 0;
                long r = days * DAY_MS + hours * HOU_MS + min * MIN_MS + sec * SEC_MS + ms;
                if( mat.group(SIM_SGN) != null && mat.group( SIM_SGN ).equals( "-" ) ) {
                    r = -r;
                }
                result = r;
            } else if( "*".equals( trimmed ) || "+*".equals( trimmed ) ) {
                // positive infinity
                result = Long.MAX_VALUE;
            } else if( "-*".equals( trimmed ) ) {
                // negative infinity
                result = Long.MIN_VALUE;
            } else {
                throw new RuntimeException( "Error parsing time string: [ " + time + " ]" );
            }
        }
        return result;
    }
182776
private Date getTimeFromInteger(Integer time)
   {
      Date result = null;

      if (time != null)
      {
         int minutes = time.intValue();
         int hours = minutes / 60;
         minutes -= (hours * 60);

         Calendar cal = DateHelper.popCalendar();
         cal.set(Calendar.MILLISECOND, 0);
         cal.set(Calendar.SECOND, 0);
         cal.set(Calendar.MINUTE, minutes);
         cal.set(Calendar.HOUR_OF_DAY, hours);
         result = cal.getTime();
         DateHelper.pushCalendar(cal);
      }

      return (result);
   }
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));
    }
226869
public static long fromTimecode(String time) {
    checkNotEmpty(time, "time must not be empty string");
    Matcher m = TIME_REGEX.matcher(time);
    if (!m.find()) {
      throw new IllegalArgumentException("invalid time '" + time + "'");
    }

    long hours = Long.parseLong(m.group(1));
    long mins = Long.parseLong(m.group(2));
    double secs = Double.parseDouble(m.group(3));

    return HOURS.toNanos(hours) + MINUTES.toNanos(mins) + (long) (SECONDS.toNanos(1) * secs);
  }
26064
public static long getDelayMillis(String time) {
		String pattern = "HH:mm";
		Date now = new Date();
		if (StringUtils.contains(time, "-")) {
			String start = time.split("-")[0];
			String end = time.split("-")[1];
			if (StringUtils.contains(start, ":") && StringUtils.contains(end, ":")) {
				Date d1 = getCurrentDateByPlan(start, pattern);
				Date d2 = getCurrentDateByPlan(end, pattern);
				while (d1.before(now)) {
					d1 = DateUtils.addDays(d1, 1);
				}

				while (d2.before(d1)) {
					d2 = DateUtils.addDays(d2, 1);
				}

				return RandomUtil.nextLong(d1.getTime() - now.getTime(), d2.getTime() - now.getTime());
			}
		} else if (StringUtils.isNumeric(time)) {
			return Long.parseLong(time);
		}

		// default
		return getDelayMillis("02:00-05:00");
	}
966551
public static String time2DateString(java.sql.Timestamp time, Locale locale) {
        DateFormat df = DateFormat.getDateInstance(dateStyle, locale);
        return df.format(time);
    }
451898
public static String convert2String(long time, String format) {
        if (time > 0l) {
            if (StringUtil.isEmpty(format))
                format = dateTimeFormat;
            SimpleDateFormat sf = new SimpleDateFormat(format);
            Date date = new Date(time);
            return sf.format(date);
        }
        return "";
    }
1197758
public static java.sql.Time toSqlTime(String time) {
		java.util.Date newDate = toDate("1/1/1970", time);

		if (newDate != null)
			return new java.sql.Time(newDate.getTime());
		else
			return null;
	}