ChronoInterval<PlainTimestamp> missed0 = missed.get(0); PlainTimestamp tsp = missed0.getStart().getTemporal(); LocalDateTime ldt = // joda-equivalent new LocalDateTime( tsp.getYear(), tsp.getMonth(), tsp.getDayOfMonth(), tsp.getHour(), tsp.getMinute(), tsp.getSecond(), tsp.get(PlainTime.MILLI_OF_SECOND)); System.out.println(ldt); // 2016-01-01T10:00:00.000
@Override public LocalDateTime from(PlainTimestamp tsp) { return LocalDateTime.of( tsp.getYear(), tsp.getMonth(), tsp.getDayOfMonth(), tsp.getHour(), tsp.getMinute(), tsp.getSecond(), tsp.getNanosecond() ); }
@Override public <V> V getMaximum(ChronoElement<V> element) { V max; if (this.timestamp.contains(element)) { max = this.timestamp.getMaximum(element); } else { max = this.moment.getMaximum(element); } if ( (element == SECOND_OF_MINUTE) && (this.timestamp.getYear() >= 1972) ) { PlainTimestamp ts = this.timestamp.with(element, max); if (!this.zone.isInvalid(ts, ts)) { Moment transformed = ts.in(this.zone); Moment test = transformed.plus(1, SI.SECONDS); if (test.isLeapSecond()) { return element.getType().cast(Integer.valueOf(60)); } } } return max; }
@Override public CalendarYear createFrom( TimeSource<?> clock, AttributeQuery attributes ) { Timezone zone; if (attributes.contains(Attributes.TIMEZONE_ID)) { zone = Timezone.of(attributes.get(Attributes.TIMEZONE_ID)); } else if (attributes.get(Attributes.LENIENCY, Leniency.SMART).isLax()) { zone = Timezone.ofSystem(); } else { return null; } int y = Moment.from(clock.currentTime()).toZonalTimestamp(zone.getID()).getYear(); return CalendarYear.of(y); }