本文整理了Java中org.joda.time.LocalDate.minus()
方法的一些代码示例,展示了LocalDate.minus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.minus()
方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:minus
[英]Returns a copy of this date with the specified period taken away.
If the amount is zero or null, then this
is returned.
This method is typically used to subtract complex period instances. Subtracting one field is best achieved using methods like #minusYears(int).
Unsupported time fields are ignored, thus subtracting a period of 24 hours will not have any effect.
[中]返回此日期的副本,并删除指定的时间段。
如果金额为零或空,则返回this
。
此方法通常用于减去复杂周期实例。减去一个字段最好使用#minusYears(int)等方法。
不支持的时间字段将被忽略,因此减去24小时的时间段不会产生任何效果。
代码示例来源:origin: org.kill-bill.billing/killbill-invoice
public static LocalDate recedeByNPeriods(final LocalDate initialDate, final BillingPeriod billingPeriod, final int nbPeriods) {
LocalDate proposedDate = initialDate;
for (int i = 0; i < nbPeriods; i++) {
proposedDate = proposedDate.minus(billingPeriod.getPeriod());
}
return proposedDate;
}
}
代码示例来源:origin: org.isisaddons.module.fakedata/isis-module-fakedata-dom
@Programmatic
public LocalDate before(final Period period) {
final LocalDate now = fake.clockService.now();
return now.minus(period);
}
代码示例来源:origin: org.kill-bill.billing/killbill-invoice
public static BigDecimal calculateProRationBeforeFirstBillingPeriod(final LocalDate startDate, final LocalDate nextBillingCycleDate,
final BillingPeriod billingPeriod) {
final LocalDate previousBillingCycleDate = nextBillingCycleDate.minus(billingPeriod.getPeriod());
return calculateProrationBetweenDates(startDate, nextBillingCycleDate, previousBillingCycleDate, nextBillingCycleDate);
}
代码示例来源:origin: org.kill-bill.billing/killbill-invoice
private void calculateLastBillingCycleDate() {
// IN_ARREAR cases
if (effectiveEndDate == null || effectiveEndDate.compareTo(firstBillingCycleDate) < 0 ) {
lastBillingCycleDate = null;
return;
}
// Start from firstBillingCycleDate and billingPeriod until we pass the effectiveEndDate
LocalDate proposedDate = firstBillingCycleDate;
int numberOfPeriods = 0;
while (!proposedDate.isAfter(effectiveEndDate)) {
proposedDate = InvoiceDateUtils.advanceByNPeriods(firstBillingCycleDate, billingPeriod, numberOfPeriods);
numberOfPeriods += 1;
}
// Our proposed date is billingCycleDate prior to the effectiveEndDate
proposedDate = proposedDate.minus(billingPeriod.getPeriod());
proposedDate = BillCycleDayCalculator.alignProposedBillCycleDate(proposedDate, billingCycleDay, billingPeriod);
if (proposedDate.isBefore(firstBillingCycleDate)) {
// Make sure not to go too far in the past
lastBillingCycleDate = firstBillingCycleDate;
} else {
lastBillingCycleDate = proposedDate;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!