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.* ;
  9.  
  10. /* Name of the class has to be "Main" only if the class is public. */
  11. class Ideone
  12. {
  13. public static void main (String[] args) throws java.lang.Exception
  14. {
  15.  
  16.  
  17. ZoneId z = ZoneId.of( "America/Los_Angeles" ) ;
  18.  
  19. ZonedDateTime zdt = ZonedDateTime.now( z ) ;
  20.  
  21. String output = zdt.toString() ;
  22.  
  23. Locale locale = new Locale( "nl" , "NL" ) ;
  24. DateTimeFormatter f =
  25. DateTimeFormatter
  26. .ofLocalizedDateTime( FormatStyle.FULL )
  27. .withLocale( locale )
  28. ;
  29. String output2 = zdt.format( f ) ;
  30.  
  31. System.out.println( output ) ;
  32. System.out.println( output2 ) ;
  33.  
  34. }
  35. }
Success #stdin #stdout 0.24s 40940KB
stdin
Standard input is empty
stdout
2020-07-17T09:30:58.183568-07:00[America/Los_Angeles]
vrijdag 17 juli 2020 om 09:30:58 Pacific-zomertijd