fork download
  1. import java.time.Instant;
  2. import java.time.ZoneId;
  3. import java.time.zone.ZoneOffsetTransition;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7. ZoneId zoneId = ZoneId.of("Europe/London");
  8. ZoneOffsetTransition nextTransition = zoneId.getRules().previousTransition(Instant.now());
  9. System.out.println("Local date-time before the transition: " + nextTransition.getDateTimeBefore());
  10. System.out.println("Zone offset before the transition: " + nextTransition.getOffsetBefore());
  11. }
  12. }
Success #stdin #stdout 0.12s 54284KB
stdin
Standard input is empty
stdout
Local date-time before the transition: 2021-03-28T01:00
Zone offset before the transition: Z