本文整理汇总了Java中java.time.LocalDate.atTime方法的典型用法代码示例。如果您正苦于以下问题:Java LocalDate.atTime方法的具体用法?Java LocalDate.atTime怎么用?Java LocalDate.atTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.LocalDate
的用法示例。
在下文中一共展示了LocalDate.atTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReservations
import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public Set<Reservation> getReservations(String venue, LocalDate date, LocalTime startTime, Duration duration) {
// Let's start from an implementation of the simplest linear searh algorithm
LocalDateTime startDateTime = date.atTime(startTime);
LocalDateTime endDateTime = startDateTime.plus(duration);
return getVenueReservations(venue).filter(conflictReservation -> {
LocalDateTime conflictStartDateTime = conflictReservation.getDate().atTime(conflictReservation.getStartTime());
LocalDateTime conflictEndDateTime = conflictStartDateTime.plus(conflictReservation.getDuration());
return startDateTime.isEqual(conflictStartDateTime)
|| isInBetween(startDateTime, conflictStartDateTime, conflictEndDateTime)
|| isInBetween(endDateTime, conflictStartDateTime, conflictEndDateTime)
|| isInBetween(conflictStartDateTime, startDateTime, endDateTime)
|| isInBetween(conflictEndDateTime, startDateTime, endDateTime);
}).collect(toSet());
}
示例2: testIsInBetweenLeftPlusASecond
import java.time.LocalDate; //导入方法依赖的package包/类
@Test
public void testIsInBetweenLeftPlusASecond() throws Exception {
LocalDateTime leftDateTime = LEFT_DATE.atTime(LEFT_TIME);
LocalTime testTime = LEFT_TIME.plusSeconds(1);
LocalDate testDate = LEFT_DATE;
LocalDateTime testDateTime = testDate.atTime(testTime);
LocalDateTime rightDateTime = RIGHT_DATE.atTime(RIGHT_TIME);
assertTrue("testDateTime is expected in between leftDateTime and rightDateTime",
reservationDao.isInBetween(testDateTime, leftDateTime, rightDateTime));
}
示例3: format
import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public boolean format(DateTimePrintContext context, StringBuilder buf) {
ZoneId zone = context.getValue(TemporalQueries.zoneId());
if (zone == null) {
return false;
}
String zname = zone.getId();
if (!(zone instanceof ZoneOffset)) {
TemporalAccessor dt = context.getTemporal();
int type = GENERIC;
if (!isGeneric) {
if (dt.isSupported(ChronoField.INSTANT_SECONDS)) {
type = zone.getRules().isDaylightSavings(Instant.from(dt)) ? DST : STD;
} else if (dt.isSupported(ChronoField.EPOCH_DAY) &&
dt.isSupported(ChronoField.NANO_OF_DAY)) {
LocalDate date = LocalDate.ofEpochDay(dt.getLong(ChronoField.EPOCH_DAY));
LocalTime time = LocalTime.ofNanoOfDay(dt.getLong(ChronoField.NANO_OF_DAY));
LocalDateTime ldt = date.atTime(time);
if (zone.getRules().getTransition(ldt) == null) {
type = zone.getRules().isDaylightSavings(ldt.atZone(zone).toInstant()) ? DST : STD;
}
}
}
String name = getDisplayName(zname, type, context.getLocale());
if (name != null) {
zname = name;
}
}
buf.append(zname);
return true;
}
示例4: test_atTime_int_int_int_int_secondTooBig
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_secondTooBig() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(11, 30, 60, 50);
}
示例5: create
import java.time.LocalDate; //导入方法依赖的package包/类
static DateTimeParameterObject create(final LocalDate localDate, @Nullable final String pattern) {
final LocalDateTime localDateTime = localDate.atTime(LocalTime.MIN);
return new DateTimeParameterObject(localDateTime, pattern);
}
示例6: test_atTime_int_int_int_int_nanoTooBig
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_nanoTooBig() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(11, 30, 40, 1000000000);
}
示例7: test_atTime_LocalTime_null
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void test_atTime_LocalTime_null() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime((LocalTime) null);
}
示例8: test_atTime_int_int_int_secondTooBig
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_secondTooBig() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(11, 30, 60);
}
示例9: test_atTime_int_int_int_int_hourTooSmall
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_hourTooSmall() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(-1, 30, 40, 50);
}
示例10: test_atTime_int_int_minuteTooBig
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_minuteTooBig() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(11, 60);
}
示例11: test_atTime_int_int_int_int_minuteTooBig
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_minuteTooBig() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(11, 60, 40, 50);
}
示例12: test_atTime_int_int_int_hourTooSmall
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_hourTooSmall() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(-1, 30, 40);
}
示例13: test_atTime_int_int_int_hourTooBig
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_hourTooBig() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(24, 30, 40);
}
示例14: test_atTime_int_int_int_int_secondTooSmall
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_secondTooSmall() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(11, 30, -1, 50);
}
示例15: test_atTime_int_int_int_minuteTooBig
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_minuteTooBig() {
LocalDate t = LocalDate.of(2008, 6, 30);
t.atTime(11, 60, 40);
}