fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.TimeZone;
  4. import java.text.*;
  5. import java.util.Date;;
  6.  
  7. class Ideone {
  8.  
  9. public static void main(String[] args)
  10. {
  11.  
  12. SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
  13. sdf.setTimeZone(TimeZone.getTimeZone("America/Sao_Paulo"));
  14. try
  15.  
  16. {
  17. String inputdate = "20161016052355";
  18. Date t = sdf.parse(inputdate);
  19.  
  20. SimpleDateFormat out = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss zzzz");
  21. out.setTimeZone(TimeZone.getTimeZone("America/Sao_Paulo"));
  22. System.out.println(out.format(t));
  23. }
  24. catch(ParseException e)
  25. {
  26.  
  27. }
  28. }
  29. }
Success #stdin #stdout 0.18s 321472KB
stdin
Standard input is empty
stdout
2016/10/16 05:23:55 Brasilia Summer Time