Parse clock time in java 8
LocalTime.parse Since you only have a time use the LocalTime class. No need to define a formatting pattern in your case. String str = “12:22:10”; LocalTime time = LocalTime.parse(str); See that code run live at IdeOne.com. See Oracle Tutorial for more info.