return parseTimeString(duration.toString());
final int index = findIndexOfNonDigit(datePattern); if (index == -1) { throw new IllegalStateException("Incorrect time format given: " + datePattern); try { final int val = Integer.parseInt(datePattern.substring(0, index)); final String type = datePattern.substring(index); final ChronoUnit unit; ...
Pattern timePattern = Pattern.compile("[1-9][0-9]*(y|mo|w|h|d|m|s)"); Matcher matcher = timePattern.matcher(time); int years = 0; int months = 0; int weeks = 0; int days = 0; int hours = 0; int minutes = 0; ...