fork(1) 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. Locale locale = new Locale.Builder().setLanguage( "uk" ).setRegion( "UA" ).build();
  16. DateTimeFormatter f = DateTimeFormatter.ofPattern( "EEEE dd MMMM HH:mm yyyy" ).withLocale( locale );
  17.  
  18. LocalDateTime ldt = LocalDateTime.of( 2021 , Month.APRIL , 12 , 7 , 0 );
  19. String output = ldt.format( f );
  20. LocalDateTime ldt2 = LocalDateTime.parse( output , f );
  21.  
  22. System.out.println( "ldt.toString() = " + ldt );
  23. System.out.println( "output = " + output );
  24. System.out.println( "ldt2.toString() = " + ldt2 );
  25.  
  26. }
  27. }
Success #stdin #stdout 0.26s 55116KB
stdin
Standard input is empty
stdout
ldt.toString() = 2021-04-12T07:00
output = понеділок 12 квітня 07:00 2021
ldt2.toString() = 2021-04-12T07:00