r/javahelp • u/Dependent_Finger_214 • Jan 29 '26
Convert string into java.util.date
I have two string, date (formatted yyyy-MM-dd) and time (HH:mm), how can I convert them into a java.util.date? Date.parse is deprecated
5
Upvotes
View all comments
Show parent comment
1
u/Pochono Jan 29 '26
Sorry, checked the docs. Instant.parse() will use the ISO_INSTANT formatter. Try this:
LocalDateTime.parse(your string, formatter). This will give you a LocalDateTime. If you need Instant, you can convert after.