LocalDateTime ldt = LocalDateTime.of(2015, 3, 29, 2, 30, 0, 0); ZoneRules rules = ZoneId.of("Europe/Berlin").getRules(); ZoneOffsetTransition conflict = rules.getTransition(ldt); if (conflict != null && conflict.isGap()) { ldt = conflict.getDateTimeAfter(); } System.out.println(ldt); // 2015-03-29T03:00
if (trans.isGap()) { localTransitionList.add(trans.getDateTimeBefore()); localTransitionList.add(trans.getDateTimeAfter()); } else { localTransitionList.add(trans.getDateTimeAfter()); localTransitionList.add(trans.getDateTimeBefore());
if (trans.isGap()) { localTransitionList.add(trans.getDateTimeBefore()); localTransitionList.add(trans.getDateTimeAfter()); } else { localTransitionList.add(trans.getDateTimeAfter()); localTransitionList.add(trans.getDateTimeBefore());
if (trans.isGap()) { localTransitionList.add(trans.getDateTimeBefore()); localTransitionList.add(trans.getDateTimeAfter()); } else { localTransitionList.add(trans.getDateTimeAfter()); localTransitionList.add(trans.getDateTimeBefore());
if (trans.isGap()) { localTransitionList.add(trans.getDateTimeBefore()); localTransitionList.add(trans.getDateTimeAfter()); } else { localTransitionList.add(trans.getDateTimeAfter()); localTransitionList.add(trans.getDateTimeBefore());
/** * Finds the offset info for a local date-time and transition. * * @param dt the date-time, not null * @param trans the transition, not null * @return the offset info, not null */ private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) { LocalDateTime localTransition = trans.getDateTimeBefore(); if (trans.isGap()) { if (dt.isBefore(localTransition)) { return trans.getOffsetBefore(); } if (dt.isBefore(trans.getDateTimeAfter())) { return trans; } else { return trans.getOffsetAfter(); } } else { if (dt.isBefore(localTransition) == false) { return trans.getOffsetAfter(); } if (dt.isBefore(trans.getDateTimeAfter())) { return trans.getOffsetBefore(); } else { return trans; } } }
/** * Finds the offset info for a local date-time and transition. * * @param dt the date-time, not null * @param trans the transition, not null * @return the offset info, not null */ private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) { LocalDateTime localTransition = trans.getDateTimeBefore(); if (trans.isGap()) { if (dt.isBefore(localTransition)) { return trans.getOffsetBefore(); } if (dt.isBefore(trans.getDateTimeAfter())) { return trans; } else { return trans.getOffsetAfter(); } } else { if (dt.isBefore(localTransition) == false) { return trans.getOffsetAfter(); } if (dt.isBefore(trans.getDateTimeAfter())) { return trans.getOffsetBefore(); } else { return trans; } } }
ZoneOffsetTransition trans = rules.getTransition(ldt); if (trans != null && trans.isGap()) { ldt = trans.getDateTimeAfter();
ZoneOffsetTransition trans = rules.getTransition(ldt); if (trans != null && trans.isGap()) { ldt = trans.getDateTimeAfter();