List of utility methods to do Duration Parse
String | parseDuration(final Duration duration) parse Duration return parseTimeString(duration.toString());
|
Duration | parseDuration(String datePattern) Parses patterns like:
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; ... |
Duration | parseDurationString(String time) parse Duration String 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; ... |