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. import java.time.temporal.TemporalAdjusters;
  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. ZoneId z = ZoneId.of( "America/Montreal" );
  16. LocalDate today = LocalDate.now( z );
  17. LocalDate firstOfMonth = today.with( TemporalAdjusters.firstDayOfMonth() );
  18.  
  19. LocalDate firstOfNextMonth = today.with( TemporalAdjusters.firstDayOfNextMonth() );
  20. LocalDate ld = firstOfMonth;
  21. Locale locale = Locale.CANADA_FRENCH ;
  22. DateTimeFormatter f = DateTimeFormatter.ofLocalizedDate( FormatStyle.SHORT ).withLocale( locale );
  23. System.out.println( ld.getMonth().getDisplayName( TextStyle.FULL , locale ) ); // Print localized name of the month being reported.
  24. do {
  25. System.out.println( ld.format( f ) ); // Create String representing this date.
  26. // Prepare for next loop. Move to next day.
  27. ld = ld.plusDays( 1 );
  28. } while ( ld.isBefore( firstOfNextMonth ) );
  29. }
  30. }
Success #stdin #stdout 0.12s 712192KB
stdin
Standard input is empty
stdout
octobre
16-10-01
16-10-02
16-10-03
16-10-04
16-10-05
16-10-06
16-10-07
16-10-08
16-10-09
16-10-10
16-10-11
16-10-12
16-10-13
16-10-14
16-10-15
16-10-16
16-10-17
16-10-18
16-10-19
16-10-20
16-10-21
16-10-22
16-10-23
16-10-24
16-10-25
16-10-26
16-10-27
16-10-28
16-10-29
16-10-30
16-10-31