Parsing time strings like “1h 30min”
You’ll probably have to tweak this a bit for your own format, but try something along these lines: PeriodFormatter formatter = new PeriodFormatterBuilder() .appendDays().appendSuffix(“d “) .appendHours().appendSuffix(“h “) .appendMinutes().appendSuffix(“min”) .toFormatter(); Period p = formatter.parsePeriod(“2d 5h 30min”); note that there is a appendSuffix that takes a variants parameter if you need to make it more flexible. Update: … Read more