@Override public ZonedDateTime convertFrom(ZonedDateTime odt, Type<ZonedDateTime> type, MappingContext mappingContext) { return ZonedDateTime.from(odt); } }
@Override public ZonedDateTime convertTo(ZonedDateTime odt, Type<ZonedDateTime> type, MappingContext mappingContext) { return ZonedDateTime.from(odt); }
@Override public ZonedDateTime fromString(String string) { return ZonedDateTime.from( ZonedDateTimeType.FORMATTER.parse( string ) ); }
private String prettyResult(Object entryValue, String tzID) { if (entryValue instanceof InetAddress ) { return ((InetAddress) entryValue).getHostAddress(); } else if (entryValue instanceof Date) { ZonedDateTime zdt = ZonedDateTime.from(((Date) entryValue).toInstant().atZone(ZoneId.of(tzID))); return(String.valueOf(zdt.format(dateTimeFormatter))); } else { return String.valueOf(entryValue); } }
@Override protected Object clone() throws CloneNotSupportedException { AbstractGCEvent<T> clonedEvent = (AbstractGCEvent<T>)super.clone(); if (getDatestamp() != null) { clonedEvent.setDateStamp(ZonedDateTime.from(this.getDatestamp())); } if (getExtendedType() != null) { clonedEvent.setExtendedType(new ExtendedType(getExtendedType().getType(), getExtendedType().fullName)); } if (details != null) { List<T> detailClones = new ArrayList<>(); for (T t : details) { detailClones.add((T)t.clone()); } clonedEvent.details = detailClones; } // don't need to do anything with "generation", because that value is reset by the "add()" method return clonedEvent; }
break; case HALF_DAY: ZonedDateTime halfDay = ZonedDateTime.from(zonedDateTime).truncatedTo(ChronoUnit.DAYS) .plus(1, ChronoUnit.HALF_DAYS); if ( zonedDateTime.isBefore(halfDay) ) {
public DateTimeType(ZonedDateTime zoned) { this.zonedDateTime = ZonedDateTime.from(zoned).withFixedOffsetZone(); }
/** * Parse the given input into a Joda {@link DateTime}. */ default DateTime parseJoda(String input) { ZonedDateTime dateTime = ZonedDateTime.from(parse(input)); return new DateTime(dateTime.toInstant().toEpochMilli(), DateUtils.zoneIdToDateTimeZone(dateTime.getZone())); }
@Override public ZonedDateTime queryFrom(TemporalAccessor temporal) { return ZonedDateTime.from(temporal); } };
/** * @return Returns the expirationDate. */ public ZonedDateTime getExpirationDate() { return this.expirationDate == null ? null : ZonedDateTime.from(this.expirationDate); }
/** * Utility for creating a ZonedDateTime object from a ZonedDateTime. * * @param time ZonedDateTime to be copied * @return ZonedDateTime representing time */ public static ZonedDateTime zonedDateTimeOf(final TemporalAccessor time) { return ZonedDateTime.from(time); }
@Override protected ZonedDateTime createTemporal(TemporalAccessor temporalAccessor) { return ZonedDateTime.from(temporalAccessor); }
@Override public ZonedDateTime queryFrom(TemporalAccessor temporal) { return ZonedDateTime.from(temporal); } },
/** * Parses the argument using {@link DateTimeFormatter#ISO_DATE_TIME}. */ public ZonedDateTime parse(final String text) { return ZonedDateTime.from(ISO_DATE_TIME.parse(text)); }
public ZonedDateTime toZonedDateTime(long date) { if (date == 0) { return null; } else if (date > 0) { Instant instant = Instant.ofEpochMilli(date); return ZonedDateTime.from(instant.atZone(zoneId)); } else { throw new IllegalArgumentException("The value \"date\" must be greater than or equal to zero."); } }
private String prettyResult(Object entryValue, String tzID) { if (entryValue instanceof InetAddress ) { return ((InetAddress) entryValue).getHostAddress(); } else if (entryValue instanceof Date) { ZonedDateTime zdt = ZonedDateTime.from(((Date) entryValue).toInstant().atZone(ZoneId.of(tzID))); return(String.valueOf(zdt.format(dateTimeFormatter))); } else { return String.valueOf(entryValue); } }
/** * Parses the date using the formatter to create * {@link ZonedDateTime} instances. * @param date The date to parse. * @param formatter The formatter to use. */ public ZonedDateTimeOf(final CharSequence date, final DateTimeFormatter formatter) { this.parsed = new UncheckedScalar<>( () -> ZonedDateTime.from(formatter.parse(date)) ); }
/** * Parses the date using the formatter to create * {@link ZonedDateTime} instances. * @param date The date to parse. * @param formatter The formatter to use. */ public ZonedDateTimeOf(final CharSequence date, final DateTimeFormatter formatter) { this.parsed = new UncheckedScalar<>( () -> ZonedDateTime.from(formatter.parse(date)) ); }
/** * Parses the date using the formatter to create * {@link OffsetDateTime} instances. * @param date The date to parse. * @param formatter The formatter to use. */ public OffsetDateTimeOf(final CharSequence date, final DateTimeFormatter formatter) { this.parsed = new UncheckedScalar<>( () -> ZonedDateTime.from(formatter.parse(date)).toOffsetDateTime() ); }
public static ZonedDateTime toZonedDateTime(TemporalAccessor accessor, ZonedDateTime defaults) { try { return ZonedDateTime.from(accessor); } catch (DateTimeException e ) {