fork(1) 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.SimpleDateFormat;
  7. import java.util.Date;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. static SimpleDateFormat format;
  13. public static String convertDate(String dateformat,Long date){
  14. format = new SimpleDateFormat(dateformat);
  15. String formattedDate = format.format(date);
  16. return formattedDate;
  17. }
  18. public static void main (String[] args) throws java.lang.Exception
  19. {
  20. // your code goes here
  21. long cal=1386059340010l;
  22.  
  23. String dateString=convertDate("MMM dd,yyyy HH:mm:ss a", cal);
  24. System.out.println(dateString);
  25. }
  26. }
Success #stdin #stdout 0.12s 321088KB
stdin
Standard input is empty
stdout
Dec 03,2013 08:29:00 AM