I tried to use DateTimeFormatter for it, but not found way. Duration.parse("") only use special format.
You can parse the String yourself and reformat it into the format required by Duration
String value = ... //mm:ss
String[] fields = value.split(":");
return Duration.parse(String.format("P%dM%sS", fields[0], fields[1]));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With