Konwertuj datę na ciąg za pomocą symulacji symulacji
Mam problemy z konwersją daty na ciąg w innym formacie. Data:
lastDownloadDate>>Wed Feb 27 16:20:23 IST 2013
lastChangeDate>>Wed Feb 27 15:11:00 IST 2013
Chcę przekonwertować ten format na inny format:yyyy-mm-dd HH:mm:ss
.
Kiedy próbuję go przekonwertować, otrzymuję różne wyniki, używając:
DateFormat outputFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
String lastDownloadTimeVal = outputFormat.format(lastDownloadDate);
System.out.println("lastDownloadTimeVal>>"+lastDownloadTimeVal);
String lastChangeTimeVal = outputFormat.format(lastChangeDate);
System.out.println("lastChangeTimeVal>>"+lastChangeTimeVal);
Otrzymuję zły wynik, miesiąc jest zastępowany minutami:
lastDownloadTimeVal>>2013-20-27 16:20:23
lastChangeTimeVal>>2013-11-27 15:11:00