fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.time.*;
  8. import java.time.format.DateTimeFormatter;
  9. import java.time.format.FormatStyle;
  10. import java.time.format.TextStyle;
  11. import java.time.temporal.TemporalAdjuster;
  12. import java.time.temporal.TemporalAdjusters;
  13. import java.time.temporal.WeekFields;
  14. import java.util.*;
  15.  
  16. /* Name of the class has to be "Main" only if the class is public. */
  17. class Ideone
  18. {
  19. public static void main (String[] args) throws java.lang.Exception
  20. {
  21. Instant instant = Instant.parse( "2021-08-31T22:00:00Z" );
  22. ZoneId z = ZoneId.of( "Europe/Stockholm" );
  23. ZonedDateTime zdt = instant.atZone( z );
  24. LocalDate ld = zdt.toLocalDate();
  25. DateTimeFormatter f = DateTimeFormatter.ofPattern( "dd-MM-uuuu" );
  26. String output = ld.format( f );
  27.  
  28. System.out.println( zdt ) ;
  29. }
  30. }
Success #stdin #stdout 0.2s 59676KB
stdin
Standard input is empty
stdout
2021-09-01T00:00+02:00[Europe/Stockholm]