fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.text.*;
  6. import java.io.*;
  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. SimpleDateFormat inputFormat =
  14. new SimpleDateFormat("kk:mm", Locale.US);
  15. inputFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
  16.  
  17. SimpleDateFormat outputFormat =
  18. new SimpleDateFormat("yyyy/MM/dd kk:mm", Locale.US);
  19. outputFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
  20.  
  21. Date date = inputFormat.parse("12:00");
  22.  
  23. System.out.println("Time Is: " + outputFormat.format(date));
  24. }
  25. }
Success #stdin #stdout 0.16s 321344KB
stdin
Standard input is empty
stdout
Time Is: 1970/01/01 12:00