Vorrei analizzare una data. La mia data per le stringhe è "Gio 19 Gen 2012 20:00". E il mio codice da analizzare è:java.text.ParseException: Data non analizzabile: "Gio 19 Gen 2012 08:00 PM"
format = new SimpleDateFormat("EEE MMM dd yyyy hh:mm aaa");
this.settDate(new Timestamp((format.parse(sDate)).getTime()));
Tuttavia, non funziona. Come posso analizzare questa data?
metodo completo è:
public void saveTask(int iDevice, String description, String sDate) throws ParseException {
format = new SimpleDateFormat("EEE MMM dd yyyy hh:mm aaa");
this.setiDeviceId(iDevice);
this.setsDescription(description);
this.settDate(new Timestamp((format.parse(sDate)).getTime()));
DatabaseManager.save(this);
}
E eccezione:
java.text.ParseException: Unparseable date: "Thu Jan 19 2012 01:00 AM"
Debug immagine:
Grazie!
Hai provato 'format = new SimpleDateFormat (" EEE MMM gg aaaa hh: mm a ");' – bdares
il tuo codice funziona correttamente per me. Mostra altro codice. – dogbane
il tuo formato va bene, funziona per me, ricevo: 'Gio 19:00 20:00 SAST 2012' qual è il tuo errore, come funziona? – epoch