List of usage examples for java.time LocalDate atTime
public OffsetDateTime atTime(OffsetTime time)
From source file:Main.java
public static void main(String[] args) { LocalDate a = LocalDate.of(2014, 6, 30); OffsetDateTime o = a.atTime(OffsetTime.now()); System.out.println(o);/*from ww w.j av a 2 s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { LocalDate a = LocalDate.of(2014, 6, 30); LocalDateTime l = a.atTime(LocalTime.NOON); System.out.println(l);/*w w w . j av a 2s . co m*/ }
From source file:Main.java
public static void main(String[] args) { LocalDate today = LocalDate.now(); // Get the Year, check if it's leap year System.out.println("Year " + today.getYear() + " is Leap Year? " + today.isLeapYear()); // Compare two LocalDate for before and after System.out.println("Today is before 01/01/2015? " + today.isBefore(LocalDate.of(2015, 1, 1))); // Create LocalDateTime from LocalDate System.out.println("Current Time=" + today.atTime(LocalTime.now())); }
From source file:co.com.soinsoftware.hotelero.view.JFRoomPayment.java
private Date getFinalDate(final Date initialDate, final int hour) { final LocalDate today = LocalDate.now(); LocalDateTime finalDateTime = null; if (DateUtils.isSameDay(initialDate, new Date())) { finalDateTime = today.plusDays(1).atTime(LocalTime.of(hour, 0)); } else {// ww w . j a v a 2 s . c o m finalDateTime = today.atTime(LocalTime.of(hour, 0)); } final ZonedDateTime zdt = finalDateTime.atZone(ZoneId.systemDefault()); return Date.from(zdt.toInstant()); }
From source file:org.jbb.members.impl.base.search.MemberSpecifications.java
public static Specification<MemberEntity> withJoinCriteria(LocalDate date, JoinMoment joinMoment) { if (date == null || joinMoment == null) { return null; }/* w w w . ja v a 2s.c o m*/ if (joinMoment.equals(JoinMoment.BEFORE)) { return (root, cq, cb) -> cb.lessThan( root.get(MemberEntity_.registrationMetaData).get(RegistrationMetaDataEntity_.joinDateTime), date.atTime(LocalTime.MIN)); } else if (joinMoment.equals(JoinMoment.THAT_DAY)) { return (root, cq, cb) -> cb.between( root.get(MemberEntity_.registrationMetaData).get(RegistrationMetaDataEntity_.joinDateTime), date.atTime(LocalTime.MIN), date.atTime(LocalTime.MAX)); } else { return (root, cq, cb) -> cb.greaterThan( root.get(MemberEntity_.registrationMetaData).get(RegistrationMetaDataEntity_.joinDateTime), date.atTime(LocalTime.MAX)); } }