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. System.out.println( Runtime.version() ) ;
  16.  
  17. // Date-only value.
  18. LocalDate localDate = LocalDate.of( 2025 , 1 , 23 ) ; // January 23, 2025.
  19.  
  20. // Localize
  21. Locale locale = new Locale( "tr" , "TR" ) ; // Turkish language, Turkey cultural norms. In modern Java, use `Locale.of` instead of constructor.
  22. DateTimeFormatter formatter =
  23. DateTimeFormatter
  24. .ofLocalizedDate( FormatStyle.FULL )
  25. .withLocale( locale ) ;
  26. String output = localDate.format( formatter ) ;
  27.  
  28. // Generate text.
  29. System.out.println( output ) ;
  30. System.out.println( localDate.toString() ) ;
  31.  
  32. System.out.println (
  33. LocalDate
  34. .of( 2025 , 1 , 23 )
  35. .format(
  36. DateTimeFormatter
  37. .ofLocalizedDate( FormatStyle.FULL )
  38. .withLocale( new Locale( "tr" , "TR" ) )
  39. )
  40. );
  41. }
  42. }
Success #stdin #stdout 0.18s 58796KB
stdin
Standard input is empty
stdout
12.0.1+12
23 Ocak 2025 Perşembe
2025-01-23
23 Ocak 2025 Perşembe