本文整理了Java中org.joda.time.LocalDateTime.plusMonths()
方法的一些代码示例,展示了LocalDateTime.plusMonths()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDateTime.plusMonths()
方法的具体详情如下:
包路径:org.joda.time.LocalDateTime
类名称:LocalDateTime
方法名:plusMonths
[英]Returns a copy of this datetime plus the specified number of months.
This LocalDateTime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
LocalDateTime added = dt.plusMonths(6);
LocalDateTime added = dt.plus(Period.months(6));
LocalDateTime added = dt.withFieldAdded(DurationFieldType.months(), 6);
[中]返回此datetime加上指定月数的副本。
此LocalDateTime实例是不可变的,不受此方法调用的影响。
以下三行实际上是相同的:
LocalDateTime added = dt.plusMonths(6);
LocalDateTime added = dt.plus(Period.months(6));
LocalDateTime added = dt.withFieldAdded(DurationFieldType.months(), 6);
代码示例来源:origin: stackoverflow.com
LocalDateTime manufacturingDate = new LocalDateTime(rs.getDate("mfg_date"));
LocalDateTime bestBefore = manufacturingDate.plusMonths(rs.getInt("UseBeforeInMonths"));
代码示例来源:origin: com.synaptix/SynaptixWidget
break;
case 'M':
dateTime = dateTime.plusMonths(nb);
break;
case 'y':
代码示例来源:origin: com.effektif/effektif-workflow-api
@Override
public LocalDateTime resolve(LocalDateTime base) {
LocalDateTime time = null;
if (HOUR_OF_DAY.equals(indexUnit)) {
time = base.withTime(index, 0, 0, 0);
if (!time.isAfter(base)) {
return time.plusDays(1);
}
} else if (DAY_OF_WEEK.equals(indexUnit)) {
time = base
.withDayOfWeek(index)
.withTime(0, 0, 0, 0);
if (!time.isAfter(base)) {
time = time.plusWeeks(1);
}
} else if (DAY_OF_MONTH.equals(indexUnit)) {
time = base
.withDayOfMonth(index)
.withTime(0, 0, 0, 0);
if (!time.isAfter(base)) {
time = time.plusMonths(1);
}
}
if (atHour!=null) {
time = time.withTime(atHour, atMinute!=null ? atMinute : 0, 0, 0);
}
return time;
}
代码示例来源:origin: effektif/effektif
@Override
public LocalDateTime resolve(LocalDateTime base) {
LocalDateTime time = null;
if (HOUR_OF_DAY.equals(indexUnit)) {
time = base.withTime(index, 0, 0, 0);
if (!time.isAfter(base)) {
return time.plusDays(1);
}
} else if (DAY_OF_WEEK.equals(indexUnit)) {
time = base
.withDayOfWeek(index)
.withTime(0, 0, 0, 0);
if (!time.isAfter(base)) {
time = time.plusWeeks(1);
}
} else if (DAY_OF_MONTH.equals(indexUnit)) {
time = base
.withDayOfMonth(index)
.withTime(0, 0, 0, 0);
if (!time.isAfter(base)) {
time = time.plusMonths(1);
}
}
if (atHour!=null) {
time = time.withTime(atHour, atMinute!=null ? atMinute : 0, 0, 0);
}
return time;
}
代码示例来源:origin: effektif/effektif
@Test
public void testIn9Months() {
LocalDateTime base = new LocalDateTime(2015, 12, 28, 9, 0, 0, 0);
LocalDateTime absoluteTime = RelativeTime.months(9).resolve(base);
assertEquals(endOfDay(base.plusMonths(9)), absoluteTime);
}
代码示例来源:origin: dremio/dremio-oss
int month = roundedUp.getMonthOfYear();
int quarter = 3 - (month - 1) % 3;
return roundedUp.plusMonths(quarter);
内容来源于网络,如有侵权,请联系作者删除!