Recommand · October 14, 2021 0

How to convert a String data and time includin month name to Date object in Java?

I want to convert the date in string to date object being the string "10h 57m 20s October 13 2020". How can be done? may replace firstly the h, m and s to get the format "10:57:20 October 13 2020"? As well, I tried the last format "10:57:20 October 13 2020" to get the date with DateTimeFormat and DateTimeFormatterBuilder() but is does not work with the month or it works but the hour coverts to 00:00:00.

Thanks

You can place fixed letters in apostrophes.

"HH'h' mm'm' ss's' MMMM dd yyyy"

Furthermore hh is the 11 hour format to be combined wiht a AM/PM.
HH is the 24 hour format.