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.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. ZonedDateTime zdt =
  15. ZonedDateTime
  16. .now(
  17. ZoneId.of( "America/Los_Angeles" )
  18. )
  19. ;
  20.  
  21. System.out.println( "zdt.toString(): " + zdt ) ;
  22.  
  23. System.out.println( "Instant.now().toString(): " + Instant.now() ) ;
  24.  
  25. }
  26.  
  27.  
  28. }
Success #stdin #stdout 0.13s 38616KB
stdin
Standard input is empty
stdout
zdt.toString(): 2019-07-27T13:00:14.783328-07:00[America/Los_Angeles]
Instant.now().toString(): 2019-07-27T20:00:14.817856Z