List of utility methods to do SQL Time From
java.sql.Time | toTime(final Object value) To time. if (value == null) { return null; if (value instanceof java.sql.Time) { return (java.sql.Time) value; if (value instanceof java.util.Date) { final Date date = (java.util.Date) value; ... |
java.sql.Time | toTime(int value) to Time int s = value % 100; if (value <= 1) { s = 1; value /= 100; int m = value % 100; int h = value / 100; Calendar c = Calendar.getInstance(); ... |
Time | toTime(java.util.GregorianCalendar cal) Converts a GregorianCalendar into a java.sql.Time. return cal == null ? null : new Time(cal.getTime().getTime()); |
Time | toTime(LocalTime localTime) to Time if (localTime == null) { return null; return new Time( Time.from(ZonedDateTime.of(LocalDate.now(), localTime, ZoneOffset.systemDefault()).toInstant()) .getTime()); |
Time | toTime(LocalTime localTime) to Time return Time.valueOf(localTime);
|
java.util.Date | toTime(Object object, Object oDefault) to Time if (object == null) { if (oDefault == null) return null; return toTime(oDefault, null); if (object instanceof java.sql.Date) { return new java.util.Date(((java.sql.Date) object).getTime()); if (object instanceof java.sql.Timestamp) { return new java.util.Date(((java.sql.Timestamp) object).getTime()); if (object instanceof java.util.Date) { return (java.util.Date) object; if (object instanceof java.util.Calendar) { return new java.util.Date(((java.util.Calendar) object).getTimeInMillis()); if (object instanceof Long) { return new java.util.Date(((Long) object).longValue()); if (object instanceof Number) { return intToTime(((Number) object).intValue()); if (object instanceof Collection) { return toTime(getFirst(object), oDefault); if (object.getClass().isArray()) { return toTime(getFirst(object), oDefault); if (object instanceof Map) { return toTime(oDefault, null); String sValue = object.toString(); if (sValue == null || sValue.length() == 0) return toTime(oDefault, null); return stringToTime(sValue); |
java.sql.Time | toTime(Object value) Convert an Object to a Time. if (value == null) { return null; if (value instanceof java.sql.Time) { return (java.sql.Time) value; if (value instanceof String) { if ("".equals((String) value)) { ... |
Timestamp | toTime(String format, String str) to Time Date date = toDate(format, str); Timestamp timestamp = new Timestamp(date.getTime()); return timestamp; |
Time | toTime(String str) to Time if (str == null) { return null; try { return (str.length() == 5 ? Time.valueOf(str + ":00") : Time.valueOf(str)); } catch (Exception e) { return null; |
Time | toTime(String value) to Time if (value != null) { return Time.valueOf(value); return null; |