fork download
  1.  
  2. /* package whatever; // don't place package name! */
  3.  
  4. import java.util.*;
  5. import java.lang.*;
  6. import java.io.*;
  7.  
  8. import java.time.* ;
  9. import java.time.format.* ;
  10.  
  11. /* Name of the class has to be "Main" only if the class is public. */
  12. class Ideone
  13. {
  14. public static void main (String[] args) throws java.lang.Exception
  15. {
  16.  
  17. System.out.println(
  18. LocalDate.parse( // Represent a date-only value, without time-of-day and without time zone.
  19. "23-Jan-2018" ,
  20. DateTimeFormatter.ofPattern( // Define a formatting pattern to match your input.
  21. "dd-MMM-uuuu" , // The modern parsing codes have changed a bit from legacy codes. Study the class documentation carefully.
  22. Locale.US // Specify a locale to determine a human language to use in translating the name of the month.
  23. )
  24. ) // Returns a `LocalDate` object.
  25. .toString() // Generate text in standard ISO 8601 format to represent the value of this `LocalDate` object.
  26. ) ;
  27.  
  28. }
  29. }
Success #stdin #stdout 0.17s 2184192KB
stdin
Standard input is empty
stdout
2018-01-23