本文整理了Java中org.joda.time.LocalDateTime.plusWeeks()
方法的一些代码示例,展示了LocalDateTime.plusWeeks()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDateTime.plusWeeks()
方法的具体详情如下:
包路径:org.joda.time.LocalDateTime
类名称:LocalDateTime
方法名:plusWeeks
[英]Returns a copy of this datetime plus the specified number of weeks.
This LocalDateTime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
LocalDateTime added = dt.plusWeeks(6);
LocalDateTime added = dt.plus(Period.weeks(6));
LocalDateTime added = dt.withFieldAdded(DurationFieldType.weeks(), 6);
[中]返回此datetime加上指定周数的副本。
此LocalDateTime实例是不可变的,不受此方法调用的影响。
以下三行实际上是相同的:
LocalDateTime added = dt.plusWeeks(6);
LocalDateTime added = dt.plus(Period.weeks(6));
LocalDateTime added = dt.withFieldAdded(DurationFieldType.weeks(), 6);
代码示例来源:origin: com.synaptix/SynaptixWidget
break;
case 'w':
dateTime = dateTime.plusWeeks(nb);
break;
default:
代码示例来源: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 testIn3Weeks() {
LocalDateTime base = new LocalDateTime(2015, 12, 28, 9, 0, 0, 0);
LocalDateTime absoluteTime = RelativeTime.weeks(3).resolve(base);
assertEquals(endOfDay(base.plusWeeks(3)), absoluteTime);
}
内容来源于网络,如有侵权,请联系作者删除!