I am trying to parse dates to LocalDateTime
.
Input dates -
{
"meetingTitle":"Test",
"fromTime":"2018-10-30 12:44",
"toTime":"2018-10-30 12:44"
}
And POJO -
private String meetingTitle;
@DateTimeFormat(iso = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))
@JsonFormat(pattern = "YYYY-MM-dd HH:mm")
private LocalDateTime fromTime;
@DateTimeFormat(iso = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))
@JsonFormat(pattern = "YYYY-MM-dd HH:mm")
private LocalDateTime toTime;
But I got this compilation error
The method ofPattern(String) is undefined for the type DateTimeFormatter
Imports -
import org.joda.time.LocalDateTime;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
Did I missed something from Example?