private CalendarOperator(int type) { super(PlainDate.COMPONENT, type); this.tsop = entity -> { PlainDate date = doApply(entity.getCalendarDate()); return entity.with(date); }; }
private PlainTimestamp handleMidnight24(PlainTimestamp entity) { PlainDate date = entity.getCalendarDate(); switch (this.mode) { case ElementOperator.OP_NAV_NEXT: case ElementOperator.OP_NAV_NEXT_OR_SAME: return date.plus(1, CalendarUnit.DAYS).atStartOfDay(); case ElementOperator.OP_NAV_PREVIOUS: case ElementOperator.OP_NAV_PREVIOUS_OR_SAME: return date.atStartOfDay(); default: throw new AssertionError("Unknown: " + this.mode); } }
private void writeTimestamp(DataOutput out) throws IOException { PlainTimestamp ts = (PlainTimestamp) this.obj; writeDate(ts.getCalendarDate(), TIMESTAMP_TYPE, out); writeTime(ts.getWallTime(), out); }
sb.append(this.timestamp.getCalendarDate()); sb.append('T'); int hour = this.timestamp.getHour();
@Override public java.sql.Timestamp from(PlainTimestamp tsp) { long dateMillis = // local millis MathUtils.safeMultiply( tsp.getCalendarDate().get(EpochDays.UNIX), 86400 * 1000 ); long timeMillis = tsp.getInt(PlainTime.MILLI_OF_DAY); if (!WITH_SQL_UTC_CONVERSION) { ZonalOffset offset = Timezone.ofSystem().getOffset(tsp, tsp); timeMillis -= offset.getIntegralAmount() * 1000; } java.sql.Timestamp ret = new java.sql.Timestamp( MathUtils.safeAdd(dateMillis, timeMillis)); ret.setNanos(tsp.getInt(PlainTime.NANO_OF_SECOND)); return ret; }
int deviation = startOfDay.getDeviation(tsp.getCalendarDate(), tzid); tsp = tsp.minus(deviation, ClockUnit.SECONDS); C date = tsp.getCalendarDate().transform(family.getChronoType(), variant); return GeneralTimestamp.of(date, time);
int deviation = startOfDay.getDeviation(tsp.getCalendarDate(), tzid); tsp = tsp.minus(deviation, ClockUnit.SECONDS); C date = tsp.getCalendarDate().transform(chronology.getChronoType()); return GeneralTimestamp.of(date, time);
private FullValueOperator(int type) { super(PlainTime.COMPONENT, type); this.tsop = entity -> { PlainTime time = doApply(entity.getWallTime()); if (time.getHour() == 24) { return PlainTimestamp.of( entity.getCalendarDate().plus(1, DAYS), PlainTime.midnightAtStartOfDay()); } else { return entity.with(time); } }; }
Date jud = sdf.parse(parseable, position); PlainTimestamp tsp = TemporalType.JAVA_UTIL_DATE.translate(jud).toZonalTimestamp(ZonalOffset.UTC); result = tsp.getCalendarDate(); updateRawValues(rawValues, sdf); } else if (this.type.equals(PlainTime.class)) {
int deviation = startOfDay.getDeviation(tsp.getCalendarDate(), offset); int comp = this.time.get(PlainTime.SECOND_OF_DAY).intValue() - deviation;
buffer.append(infinityStyle.displayPast(printer, PlainTimestamp.axis())); } else { Iso8601Format.ofDate(dateStyle).print(start.getCalendarDate(), buffer); buffer.append('T'); timePrinter.print(start.getWallTime(), buffer); PlainDate d1 = start.getCalendarDate(); PlainDate d2 = end.getCalendarDate(); if (!d1.equals(d2)) { DateInterval.getEndPrinter(dateStyle, d1, d2).print(d2, buffer);
int deviation = startOfDay.getDeviation(tsp.getCalendarDate(), tz.getID()); int comp = this.time.get(PlainTime.SECOND_OF_DAY).intValue() - deviation;
PlainDate d1 = start.toZonalTimestamp(offset).getCalendarDate(); PlainDate d2 = tsp2.getCalendarDate();
return TRANSFORMER.transform(utcDays); } else if (entity instanceof UnixTime) { return PlainTimestamp.axis().createFrom(entity, attributes, lenient, preparsing).getCalendarDate();