/** * Formats the {@code Time} as a String in JDBC escape format: {@code * hh:mm:ss}. * * @return A String representing the {@code Time} value in JDBC escape * format: {@code HH:mm:ss} */ @Override public String toString() { StringBuilder sb = new StringBuilder(8); format(getHours(), 2, sb); sb.append(':'); format(getMinutes(), 2, sb); sb.append(':'); format(getSeconds(), 2, sb); return sb.toString(); }
return LocalTime.of(time.getHours(), time.getMinutes(), time.getSeconds(), nanosOfSecond);
Assert.assertEquals(sqlTime.getSeconds(), s.getSqlTime().getSeconds()); Assert.assertEquals(sqlTime.getHours(), s.getSqlTime().getHours());
Assert.assertEquals(sqlTime.getSeconds(), s.getSqlTime().getSeconds()); Assert.assertEquals(sqlTime.getHours(), s.getSqlTime().getHours());
Assert.assertEquals(sqlTime.getSeconds(), s.getSqlTime().getSeconds()); Assert.assertEquals(sqlTime.getHours(), s.getSqlTime().getHours());
Assert.assertEquals(sqlTime.getSeconds(), s.getSqlTime().getSeconds()); Assert.assertEquals(sqlTime.getHours(), s.getSqlTime().getHours());
/** * To get the exact time now and to assign the values . */ @SuppressWarnings("deprecation") private void initTime() { Time time = new Time(System.currentTimeMillis()); int hours = time.getHours(); mHourSingleDigits = hours % 10; mHourTenDigits = hours / 10; int minutes = time.getMinutes(); mMinSingleDigits = minutes % 10; mMinTenDigits = minutes / 10; int seconds = time.getSeconds(); mSecSingleDigits = seconds % 10; mSecTenDigits = seconds / 10; }
@SuppressWarnings("deprecation") private Time withTZ(Time time, Calendar cal) { if (time == null) return null; int hour = time.getHours(); int minute = time.getMinutes(); int second = time.getSeconds(); int millis = (int) (time.getTime() % 1000); return new Time(getMillis(cal, 1970, 0, 1, hour, minute, second, millis)); }
/** * Formats the {@code Time} as a String in JDBC escape format: {@code * hh:mm:ss}. * * @return A String representing the {@code Time} value in JDBC escape * format: {@code HH:mm:ss} */ @Override public String toString() { StringBuilder sb = new StringBuilder(8); format(getHours(), 2, sb); sb.append(':'); format(getMinutes(), 2, sb); sb.append(':'); format(getSeconds(), 2, sb); return sb.toString(); }
/** * Formats the {@code Time} as a String in JDBC escape format: {@code * hh:mm:ss}. * * @return A String representing the {@code Time} value in JDBC escape * format: {@code HH:mm:ss} */ @Override public String toString() { StringBuilder sb = new StringBuilder(8); format(getHours(), 2, sb); sb.append(':'); format(getMinutes(), 2, sb); sb.append(':'); format(getSeconds(), 2, sb); return sb.toString(); }
/** * Formats the {@code Time} as a String in JDBC escape format: {@code * hh:mm:ss}. * * @return A String representing the {@code Time} value in JDBC escape * format: {@code HH:mm:ss} */ @Override public String toString() { StringBuilder sb = new StringBuilder(8); format(getHours(), 2, sb); sb.append(':'); format(getMinutes(), 2, sb); sb.append(':'); format(getSeconds(), 2, sb); return sb.toString(); }
public static LocalTime readLocalTime(ResultSet rs, String columnName) throws SQLException { // Get the time without specifying a Calendar for the time // zone, because OJB does not use it when binding the // preparedStatement also. So, we must get the java.sql.Time // in the default time zone. // // Moreover, if later we decide to change this, we must // investigate the various options for the MySQL driver, // because by default I think that it does not behave as // expected by the JDBC specification. Check the options // "noTimezoneConversionForTimeType", "useTimezone", // "useGmtMillisForDatetimes", // "useJDBCCompliantTimezoneShift", "useLegacyDatetimeCode", // and "useSSPSCompatibleTimezoneShift" (at least...). Time time = rs.getTime(columnName); // Construct the LocalTime with hours, minutes, and seconds, // for symmetry with the ToSqlConverter code (see the comment // there, also). return (rs.wasNull() ? null : new LocalTime(time.getHours(), time.getMinutes(), time.getSeconds())); }
/** * Formats the {@code Time} as a String in JDBC escape format: {@code * hh:mm:ss}. * * @return A String representing the {@code Time} value in JDBC escape * format: {@code HH:mm:ss} */ @Override public String toString() { StringBuilder sb = new StringBuilder(8); format(getHours(), 2, sb); sb.append(':'); format(getMinutes(), 2, sb); sb.append(':'); format(getSeconds(), 2, sb); return sb.toString(); }
/** * Converts a {@code java.sql.Time} to a {@code LocalTime}. * * @param sqlTime the SQL time, not null * @return the local time, not null */ @SuppressWarnings("deprecation") public static LocalTime toLocalTime(java.sql.Time sqlTime) { return LocalTime.of(sqlTime.getHours(), sqlTime.getMinutes(), sqlTime.getSeconds()); }
/** * Formats the {@code Time} as a String in JDBC escape format: {@code * hh:mm:ss}. * * @return A String representing the {@code Time} value in JDBC escape * format: {@code HH:mm:ss} */ @Override public String toString() { StringBuilder sb = new StringBuilder(8); format(getHours(), 2, sb); sb.append(':'); format(getMinutes(), 2, sb); sb.append(':'); format(getSeconds(), 2, sb); return sb.toString(); }
/** * Formats the {@code Time} as a String in JDBC escape format: {@code * hh:mm:ss}. * * @return A String representing the {@code Time} value in JDBC escape * format: {@code HH:mm:ss} */ @Override public String toString() { StringBuilder sb = new StringBuilder(8); format(getHours(), 2, sb); sb.append(':'); format(getMinutes(), 2, sb); sb.append(':'); format(getSeconds(), 2, sb); return sb.toString(); }
/** * Converts a {@code java.sql.Time} to a {@code LocalTime}. * * @param sqlTime the SQL time, not null * @return the local time, not null */ @SuppressWarnings("deprecation") public static LocalTime toLocalTime(java.sql.Time sqlTime) { return LocalTime.of(sqlTime.getHours(), sqlTime.getMinutes(), sqlTime.getSeconds()); }
/** * Converts a {@code java.sql.Time} to a {@code LocalTime}. * * @param sqlTime the SQL time, not null * @return the local time, not null */ @SuppressWarnings("deprecation") public static LocalTime toLocalTime(java.sql.Time sqlTime) { return LocalTime.of(sqlTime.getHours(), sqlTime.getMinutes(), sqlTime.getSeconds()); }
return LocalTime.of(time.getHours(), time.getMinutes(), time.getSeconds(), nanosOfSecond);
@SuppressWarnings("deprecation") protected void assertDates(Dates dates) { assertNull(dates.nullDate); assertDate(BIRTHDAY, dates.iso8601Date); assertDate(BIRTHDAY, dates.formatedDate); assertDate(BIRTHDAY, dates.sqlDate); assertDate(BIRTHDAY, dates.sqlTimestamp); assertEquals(11, dates.sqlTime.getHours()); assertEquals(22, dates.sqlTime.getMinutes()); assertEquals(33, dates.sqlTime.getSeconds()); assertEquals(11, dates.sqlTimestamp.getHours()); assertEquals(22, dates.sqlTimestamp.getMinutes()); assertEquals(33, dates.sqlTimestamp.getSeconds()); } }