本文整理匯總了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);
}