public static Duration formattedStringToDuration ( final String formattedDuration ) { if ( formattedDuration == null ) { return null ; } final TemporalAccessor ta = DateTimeFormatter . ofPattern ( DURATION_FORMAT ) . parse ( formattedDuration . trim ( ) ) ; return Duration . between ( LocalTime . MIDNIGHT , LocalTime . from ( ta ) ) ; }
Converts a formatted String into a Duration object .