-1
DateTimeZone timeZone = DateTimeZone.forID("America/Montreal");
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy/MM/dd").withZone(timeZone);
DateTime dateTimeStart = formatter.parseDateTime("2012/01/01");
DateTime dateTimeStop = formatter.parseDateTime("2017/06/12");
Period period = new Period(dateTimeStart, dateTimeStop);
PeriodFormatter periodFormatter = PeriodFormat.getDefault();
String output = periodFormatter.print(period);
System.out.println(output);
實際輸出爲5 years, 5 months, 1 week and 4 days
我想輸出(推薦):5 years, 5 months, 11 days
天應中顯示,而周
**閱讀文檔。**你做了,你會發現['Period.normalizedStandard(PeriodType type)'](http://joda-time.sourceforge.net/apidocs/org/joda/時間/ Period.html#normalizedStandard(org.joda.time.PeriodType))。 *由於缺乏研究而減少投票。* – Andreas