DateUtils.parseDateStrictly("28 Sep 2018" , "dd MMMM yyyy")
The format of the above date should be dd MMM yyyy (MMM denotes shorter month) , but MMMM also parses shorter month which causes invalid parsing. I am already using parseDateStrictly method. Any other suggestions ?
java.time
I recommend that you use java.time for your date and time work. Apache
DateUtils
was useful once we only had the poorly designedDate
andSimpleDateFormat
classes to work with. We don’t need it anymore. For a long time now we haven’t needed it.java.time behaves the way you expect out of the box.
Result:
Link
Oracle tutorial: Date Time explaining how to use java.time.