本文整理汇总了Java中java.time.LocalDate.atStartOfDay方法的典型用法代码示例。如果您正苦于以下问题:Java LocalDate.atStartOfDay方法的具体用法?Java LocalDate.atStartOfDay怎么用?Java LocalDate.atStartOfDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.LocalDate
的用法示例。
在下文中一共展示了LocalDate.atStartOfDay方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSlotsByDateRangeType
import java.time.LocalDate; //导入方法依赖的package包/类
private List<BookingSlot> getSlotsByDateRangeType(String type, LocalDate startDate) {
LocalDateTime startDateTime = startDate.atStartOfDay();
LocalDateTime endDateTime;
switch (type) {
case DATE:
endDateTime = startDateTime.plus(1, ChronoUnit.DAYS);
break;
case SCHOOL_WEEK:
endDateTime = startDateTime.plus(5, ChronoUnit.DAYS);
break;
case WEEK:
endDateTime = startDateTime.plus(1, ChronoUnit.WEEKS);
break;
default:
endDateTime = startDateTime.plus(SLOT_TIME, ChronoUnit.MINUTES);
break;
}
Timestamp startTimestamp = Timestamp.valueOf(startDateTime);
Timestamp endTimestamp = Timestamp.valueOf(endDateTime);
return slotRepository.findByTimestampRange(startTimestamp, endTimestamp);
}
示例2: parseDate
import java.time.LocalDate; //导入方法依赖的package包/类
public static LocalDateTime parseDate(String date) {
Objects.requireNonNull(date, "date");
for (DateTimeFormatter formatter : DATE_FORMATTERS) {
try {
// equals ISO_LOCAL_DATE
if (formatter.equals(DATE_FORMATTERS.get(2))) {
LocalDate localDate = LocalDate.parse(date, formatter);
return localDate.atStartOfDay();
} else {
return LocalDateTime.parse(date, formatter);
}
} catch (java.time.format.DateTimeParseException ignored) {
}
}
return null;
}
示例3: evalueer
import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public Expressie evalueer(final List<Expressie> argumenten, final Context context) {
final Integer selectiedatum = context.getProperty(ExpressieTaalConstanten.PROPERTY_DATUM_START_SELECTIE);
if (selectiedatum == null) {
throw new ExpressieRuntimeException("Geen waarde gevonden voor SELECTIE_DATUM()");
}
if (argumenten.isEmpty()) {
return new DatumLiteral(selectiedatum);
} else {
final GetalLiteral jaarVerschil = getArgument(argumenten, 0);
final LocalDate localDate = DatumUtil.vanIntegerNaarLocalDate(selectiedatum).plusYears(jaarVerschil.getWaarde());
return new DatumLiteral(localDate.atStartOfDay(DatumUtil.BRP_ZONE_ID));
}
}
示例4: test_atStartOfDay_ZoneId_null
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void test_atStartOfDay_ZoneId_null() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atStartOfDay((ZoneId) null);
}