Here you can find the source of parseLocalTime(String string)
Parameter | Description |
---|---|
string | the time |
private static LocalTime parseLocalTime(String string)
//package com.java2s; import java.time.LocalTime; import java.time.format.DateTimeFormatter; public class Main { private static final DateTimeFormatter POTENTIAL_FORMATS = DateTimeFormatter.ofPattern("[HH:mm:ss][HH:mm]"); /**/*from ww w . j a v a 2 s .co m*/ * This function attempts to parse a time. Supporting the use of potentially multiple formats from a single place. * * @param string the time * @return a LocalTIme object */ private static LocalTime parseLocalTime(String string) { return LocalTime.parse(string, POTENTIAL_FORMATS); } }