fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.time.* ;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. System.out.println( Runtime.version() ) ;
  14.  
  15. Instant instant = Instant.now() ;
  16.  
  17. ZoneId z = ZoneId.of( "Pacific/Auckland" ) ;
  18. ZonedDateTime zdt = instant.atZone( z ) ;
  19.  
  20. OffsetDateTime odt = zdt.toOffsetDateTime() ;
  21.  
  22. System.out.println( instant ) ;
  23. System.out.println( z ) ;
  24. System.out.println( zdt ) ;
  25. System.out.println( odt ) ;
  26. }
  27. }
Success #stdin #stdout 0.14s 59440KB
stdin
Standard input is empty
stdout
12.0.1+12
2024-07-07T18:28:15.268003Z
Pacific/Auckland
2024-07-08T06:28:15.268003+12:00[Pacific/Auckland]
2024-07-08T06:28:15.268003+12:00