Java examples for java.time:LocalDateTime
Returns a LocalDateTime instance for the specified date with time set to 12:00:00.
//package com.java2s; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; public class Main { /**/*from w w w.j a v a2 s . c om*/ * Returns a LocalDateTime instance for the specified date with time set to 12:00:00. * When no date is specified then the current date will be used. * * @param date contains the date to be used (optional) * @return the created LocalDateTime */ public static LocalDateTime getNoonDateTimeForDate(final LocalDate date) { final LocalDate tempDate = date == null ? LocalDate.now() : date; return LocalDateTime.of(tempDate, LocalTime.of(12, 0)); } }