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.text.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. DateFormat df = new SimpleDateFormat("dd-MMM-yy");
  14. Date start = null;
  15. Date end = null;
  16.  
  17. try {
  18. start = df.parse("11-MAR-17");
  19. end = df.parse("19-Mar-17");
  20. } catch (ParseException ex) {
  21. ex.printStackTrace();
  22. }
  23.  
  24. System.out.format("Start: %s, End: %s", df.format(start), df.format(end));
  25. }
  26. }
Success #stdin #stdout 0.11s 380864KB
stdin
Standard input is empty
stdout
Start: 11-Mar-17, End: 19-Mar-17