fork(3) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.text.SimpleDateFormat;
  5. import java.util.Date;
  6. import java.util.TimeZone;
  7. import java.text.ParseException;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. String date_string = "Mon Jul 28 00:00:00 CDT 2014";
  15.  
  16. SimpleDateFormat inputFormatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
  17. SimpleDateFormat outputFormatter = new SimpleDateFormat("EEE M/dd");
  18.  
  19. try {
  20. Date date = inputFormatter.parse(date_string);
  21. String text = outputFormatter.format(date);
  22. System.out.println(text);
  23. } catch (ParseException e) {
  24. e.printStackTrace();
  25. }
  26. }
  27. }
Success #stdin #stdout 0.11s 381056KB
stdin
Standard input is empty
stdout
Mon 7/28