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.util.Date;
  7. import java.text.SimpleDateFormat;
  8. import java.text.DateFormat;
  9. import java.util.Calendar;
  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. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault());
  17. Calendar cal = Calendar.getInstance();
  18. cal.setTime(df.parse("2019-09-10T09:55:09.000+0000"));
  19. SimpleDateFormat monthSDF = new SimpleDateFormat("MMM");
  20. SimpleDateFormat timeSDF = new SimpleDateFormat("hh:mm a");
  21. System.out.println(timeSDF.format(cal.getTime()));
  22. }
  23. }
Success #stdin #stdout 0.13s 36336KB
stdin
Standard input is empty
stdout
09:55 AM