I'm trying to convert some date values from access (MDB) database.
I'm getting this: 'Tue May 17 08:29:00 BRT 2011'. But I want this: '2011-05-17 08:29:00'.
I already tried to use JAVA 8 new DateTime classes but didn't work.
Here is what I tried:
public class DateHelper {
LocalDateTime dateTime;
public DateHelper(String dateTime) {
this.convertStringToDateTimeDeclaration(dateTime);
}
protected void convertStringToDateTimeDeclaration(String dateTime){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
this.dateTime = LocalDateTime.parse(dateTime, formatter);
}
public String getDateTime(){
return dateTime.toString();
}
}
but I get
"Exception in thread "JavaFX Application Thread" java.time.format.DateTimeParseException: Text 'Tue May 17 08:29:00 BRT 2011' could not be parsed at index 0"