thisSecondOfMinute, (this.nanoOfSecond == Integer.MIN_VALUE ? 0 : this.nanoOfSecond), zoneId).withDayOfYear(this.dayOfYear).plusDays(daysRollover); } else {
case YEAR: zonedDateTime = zonedDateTime.truncatedTo(ChronoUnit.DAYS) .withDayOfYear(1) .plus(1, ChronoUnit.YEARS); break;
public ZonedDateTime withDayOfYear(int value) { return dt.withDayOfYear(value); }
public ZonedDateTime withDayOfYear(int value) { return dt.withDayOfYear(value); }
case 'y': if (round) { dateTime = dateTime.withDayOfYear(1).with(LocalTime.MIN); } else { dateTime = dateTime.plusYears(sign * num);
public ZonedDateTime withDayOfYear(int value) { return dt.withDayOfYear(value); }
private static Object convertOutput(Context context, Type type, ZonedDateTime dateTime, Class<?> targetClass, Calendar targetCalendar) throws ConversionException { if (targetClass == OffsetDateTime.class) { return dateTime.toOffsetDateTime(); } if (targetClass == String.class) { return context.getTimestampFormat().getPrinter().format(dateTime); } ZoneId targetZoneId = targetCalendar.getTimeZone().toZoneId(); ZonedDateTime zonedDateTime = dateTime.withZoneSameInstant(targetZoneId); if (targetClass == Time.class) { return new Time(zonedDateTime.withYear(1970).withDayOfYear(1).toInstant().toEpochMilli()); } if (targetClass == Date.class) { return new Date(zonedDateTime.truncatedTo(ChronoUnit.DAYS).toInstant().toEpochMilli()); } if (targetClass == Timestamp.class) { return Timestamp.from(zonedDateTime.toInstant()); } throw new ConversionException(type, targetClass); }
private static Object convertOutput(Context context, Type type, LocalDateTime dateTime, Class<?> targetClass, Calendar targetCalendar) throws ConversionException { if (targetClass == LocalDateTime.class) { return dateTime; } if (targetClass == LocalDate.class) { return dateTime.toLocalDate(); } if (targetClass == String.class) { return context.getTimestampFormat().getPrinter().format(dateTime); } ZoneId targetZoneId = targetCalendar.getTimeZone().toZoneId(); ZonedDateTime zonedDateTime = dateTime.atOffset(ZoneOffset.UTC).atZoneSimilarLocal(targetZoneId); if (targetClass == Time.class) { return new Time(zonedDateTime.withYear(1970).withDayOfYear(1).toInstant().toEpochMilli()); } if (targetClass == Date.class) { return new Date(zonedDateTime.truncatedTo(ChronoUnit.DAYS).toInstant().toEpochMilli()); } if (targetClass == Timestamp.class) { return Timestamp.from(zonedDateTime.toInstant()); } throw new ConversionException(type, targetClass); }
public static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution) { switch (resolution) { case Year: return date.truncatedTo(ChronoUnit.DAYS).withDayOfYear(1); case Month: return date.truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1); default: return date.truncatedTo(convertDateResolutionField(resolution)); } }
case YEAR: zonedDateTime = zonedDateTime.truncatedTo(ChronoUnit.DAYS) .withDayOfYear(1) .plus(1, ChronoUnit.YEARS); break;
case YEAR: zonedDateTime = zonedDateTime.truncatedTo(ChronoUnit.DAYS) .withDayOfYear(1) .plus(1, ChronoUnit.YEARS); break;
case YEAR: zonedDateTime = zonedDateTime.truncatedTo(ChronoUnit.DAYS) .withDayOfYear(1) .plus(1, ChronoUnit.YEARS); break;
case 'y': if (round) { dateTime = dateTime.withDayOfYear(1).with(LocalTime.MIN); } else { dateTime = dateTime.plusYears(sign * num);
case 'y': if (round) { dateTime = dateTime.withDayOfYear(1).with(LocalTime.MIN); } else { dateTime = dateTime.plusYears(sign * num);