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. import java.time.temporal.* ;
  10. import java.time.chrono.* ;
  11. import java.time.zone.* ;
  12.  
  13. /* Name of the class has to be "Main" only if the class is public. */
  14. class Ideone
  15. {
  16. public static void main (String[] args) throws java.lang.Exception
  17. {
  18. ZoneId z = ZoneId.of( "Asia/Tokyo" ) ;
  19. ZonedDateTime zdt = ZonedDateTime.now( z ) ;
  20.  
  21. Locale locale = Locale.CANADA_FRENCH ;
  22. DateTimeFormatter f =
  23. DateTimeFormatter
  24. .ofLocalizedDateTime( FormatStyle.FULL )
  25. .withLocale( locale )
  26. ;
  27. String output = zdt.format( f ) ;
  28.  
  29. System.out.println( zdt.toInstant().toString() ) ;
  30. System.out.println( zdt.toString() ) ;
  31. System.out.println( output ) ;
  32. }
  33. }
Success #stdin #stdout 0.21s 41296KB
stdin
Standard input is empty
stdout
2020-07-13T23:26:40.554180Z
2020-07-14T08:26:40.554180+09:00[Asia/Tokyo]
mardi 14 juillet 2020 à 08 h 26 min 40 s heure normale du Japon