static ChronoLocalDateTime<?> readExternal(ObjectInput in) throws IOException, ClassNotFoundException { ChronoLocalDate date = (ChronoLocalDate) in.readObject(); LocalTime time = (LocalTime) in.readObject(); return date.atTime(time); }
private void resolveInstant() { if (date != null && time != null) { if (zone != null) { long instant = date.atTime(time).atZone(zone).getLong(ChronoField.INSTANT_SECONDS); fieldValues.put(INSTANT_SECONDS, instant); } else { Long offsetSecs = fieldValues.get(OFFSET_SECONDS); if (offsetSecs != null) { ZoneOffset offset = ZoneOffset.ofTotalSeconds(offsetSecs.intValue()); long instant = date.atTime(time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS); fieldValues.put(INSTANT_SECONDS, instant); } } } }
private void crossCheck() { if (fieldValues.size() > 0) { if (date != null && time != null) { crossCheck(date.atTime(time)); } else if (date != null) { crossCheck(date); } else if (time != null) { crossCheck(time); } } }
/** * Obtains a local date-time in this chronology from another temporal object. * <p> * This creates a date-time in this chronology based on the specified {@code TemporalAccessor}. * <p> * The date of the date-time should be equivalent to that obtained by calling * {@link #date(TemporalAccessor)}. * The standard mechanism for conversion between time types is the * {@link ChronoField#NANO_OF_DAY nano-of-day} field. * * @param temporal the temporal object to convert, not null * @return the local date-time in this chronology, not null * @throws DateTimeException if unable to create the date-time */ public ChronoLocalDateTime<?> localDateTime(TemporalAccessor temporal) { try { ChronoLocalDate date = date(temporal); return date.atTime(LocalTime.from(temporal)); } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain ChronoLocalDateTime from TemporalAccessor: " + temporal.getClass(), ex); } }
return new java.sql.Date(((ChronoLocalDate) original).atTime(LocalTime.MIDNIGHT) .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());