say I have 110 seconds that I want to convert to 01:50
or 00:01:50
or such. How do I do that in joda-time? I load the number into Seconds but then
You can build a formatter for your format and use that. To get the time in seconds only normalized to minutes/seconds, use normalizedStandard()
;
PeriodFormatter myFormat =
new PeriodFormatterBuilder()
.printZeroAlways().minimumPrintedDigits(2).appendMinutes()
.appendSeparator(":")
.printZeroAlways().minimumPrintedDigits(2).appendSeconds()
.toFormatter();
Period period = Period.seconds(110).normalizedStandard();
System.out.println(myFormat.print(period));
> 01:50