0
在我的代码的这一部分,我希望乔达时间计算并显示下一个生日还剩下多少时间。因此,今年要改变的生日乔达时间如何计算剩下多少时间?
DateTime startDate = DateTime.now();
DateTime endDate = new DateTime(x,m110,d110,h120,min120);
Period period = new Period(startDate, endDate, PeriodType.dayTime());
textView3.setText(formatter.print(period));
PeriodFormatter formatter = new PeriodFormatterBuilder()
.appendMonths().appendSuffix(".")
.appendDays().appendSuffix(" ")
.appendHours().appendSuffix(":")
.appendMinutes().appendSuffix(":")
.appendSeconds()
.toFormatter();
X这里是一年,M110,D110,H120,min120 - 月,日,小时和分钟。我应该写什么而不是“x”,所以它可以计算每年剩下多少时间,而不是一次。还有一个问题。例如,如果是3小时4分钟,为了显示“03:04:00”而不是“3:4:”(它也只是不显示0),我应该怎么做?