I am trying to change from standard ISO 8601 format 2014-09-11T21:28:29.429209Z
into a nice MMM d yyyy hh:mm z format, however my current code is failing.
public void setCreatedAt( String dateTime ) {
LocalDate newDateTime = LocalDate.parse(dateTime);
try {
DateTimeFormatter format = DateTimeFormatter.ofPattern("MMM d yyyy hh:mm a z");
createdAt = newDateTime.format(format);
}
catch (Exception e) {
}
}
I am receiving the time and date from an api.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…