我想从JodaTime的持续时间类获取格式化的字符串。从JodaTime持续时间格式化的字符串
Duration duration = new Duration(durationInSecond * 1000);
PeriodFormatter formatter = new PeriodFormatterBuilder()
.appendDays()
.appendSuffix(" days, ")
.appendHours()
.appendSuffix(" hours, ")
.appendMinutes()
.appendSuffix(" minutes and ")
.appendSeconds()
.appendSuffix(" seconds")
.toFormatter();
String formattedString = formatter.print(duration.toPeriod());
的formattedString
值应该为
65天,3小时,5分20秒
但它是
1563小时,5分钟, 20秒
1563小时为65天3小时,但格式化程序不是以这种方式打印的。
我在这里错过了什么?
非常感谢。 –