fork download
  1. import java.util.*;
  2. import java.text.*;
  3.  
  4. public class Main {
  5. public static SimpleDateFormat englishUtcDateFormat(String format) throws Exception {
  6. SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.ENGLISH);
  7. sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
  8. return sdf;
  9. }
  10.  
  11. public static void main(String[] args) throws Exception {
  12. SimpleDateFormat input = englishUtcDateFormat("ddMMyyyy");
  13. SimpleDateFormat output = englishUtcDateFormat("dd/MM/yyyy");
  14. System.out.println(output.format(input.parse("02122012"))); // 02/12/2012
  15. }
  16.  
  17. }
Success #stdin #stdout 0.05s 246080KB
stdin
Standard input is empty
stdout
02/12/2012