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.  
  7. import java.text.DateFormat;
  8. import java.text.SimpleDateFormat;
  9. import java.util.Date;
  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. // your code goes here
  17. DateFormat dateFormat = new SimpleDateFormat("MMMM dd,yyyy");
  18. Date currentDate = new Date();
  19. String currentDateString = dateFormat.format(currentDate);
  20. System.out.println(currentDateString);
  21. try {
  22. currentDate = dateFormat.parse(currentDateString);
  23.  
  24. } catch (Exception e) {
  25.  
  26. }
  27.  
  28.  
  29. }
  30. }
Success #stdin #stdout 0.13s 322304KB
stdin
Standard input is empty
stdout
July 04,2016