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. import java.time.format.* ;
  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. ZoneId z = ZoneId.of( "Africa/Tunis" ) ;
  15. MonthDay currentMonthDay = MonthDay.now( z ) ;
  16. // String output = currentMonthDay.toString() ; // ISO 8601 standard format.
  17. Locale locale = new Locale ( "en" , "US" );
  18. DateTimeFormatter f = DateTimeFormatter.ofPattern( "d MMMM" ).withLocale( locale ) ;
  19. String output = currentMonthDay.format( f ) ;
  20.  
  21. System.out.println( output ) ;
  22.  
  23. System.out.println(
  24. MonthDay
  25. .now( ZoneId.of( "Asia/Tokyo" ) )
  26. .format(
  27. DateTimeFormatter
  28. .ofPattern( "d MMMM" )
  29. .withLocale( new Locale( "fr" , "CA" ) )
  30. )
  31. );
  32. }
  33. }
Success #stdin #stdout 0.18s 60992KB
stdin
Standard input is empty
stdout
16 October
16 octobre