Java Utililty Methods SQL Time From

List of utility methods to do SQL Time From

Description

The list of methods to do SQL Time From are organized into topic(s).

Method

java.sql.TimetoTime(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.TimetoTime(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();
...
TimetoTime(java.util.GregorianCalendar cal)
Converts a GregorianCalendar into a java.sql.Time.
return cal == null ? null : new Time(cal.getTime().getTime());
TimetoTime(LocalTime localTime)
to Time
if (localTime == null) {
    return null;
return new Time(
        Time.from(ZonedDateTime.of(LocalDate.now(), localTime, ZoneOffset.systemDefault()).toInstant())
                .getTime());
TimetoTime(LocalTime localTime)
to Time
return Time.valueOf(localTime);
java.util.DatetoTime(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.TimetoTime(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)) {
...
TimestamptoTime(String format, String str)
to Time
Date date = toDate(format, str);
Timestamp timestamp = new Timestamp(date.getTime());
return timestamp;
TimetoTime(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;
TimetoTime(String value)
to Time
if (value != null) {
    return Time.valueOf(value);
return null;