I have the following period 1month 5d 22h 35m 39s, which I want to format as 35d 22h 35m 39s. However when using the following formatter the months are just removed and haven't been added to the days:
PeriodFormatter formatter = new PeriodFormatterBuilder()
.printZeroAlways()
.appendDays().appendSuffix(" d ")
.appendHours().appendSuffix(" h ")
.appendMinutes().appendSuffix(" m ")
.appendSeconds().appendSuffix(" s ")
.toFormatter();
After some searching I found that one is supposed to use the normalizedStandard() method on Period, but when using it with period.normalizedStandard(PeriodType.dayTime())
I am getting the following error:
java.lang.UnsupportedOperationException: Field is not supported
at org.joda.time.PeriodType.setIndexedField(PeriodType.java:690)
at org.joda.time.Period.withMonths(Period.java:851)
at org.joda.time.Period.normalizedStandard(Period.java:1541)
at amadeus.bid.wicket.markup.html.CountDownLabel.onComponentTagBody(CountDownLabel.java:34)
Any ideas?