Java LocalDateTime Calculate ceilDate(LocalDateTime dateTime)

Here you can find the source of ceilDate(LocalDateTime dateTime)

Description

Performs a "ceiling" operation on a LocalDateTime, and returns a new LocalDateTime with time set to 23:59.

License

Open Source License

Parameter

Parameter Description
dateTime LocalDateTime for operation to be performed on.

Return

"Ceiled" LocalDateTime.

Declaration

public static LocalDateTime ceilDate(LocalDateTime dateTime) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.time.LocalDateTime;

public class Main {
    /**/* ww w .j a  va 2s  . c o  m*/
     * Performs a "ceiling" operation on a LocalDateTime, and returns a new LocalDateTime
     * with time set to 23:59.
     * 
     * @param dateTime   LocalDateTime for operation to be performed on.
     * @return           "Ceiled" LocalDateTime.
     */
    public static LocalDateTime ceilDate(LocalDateTime dateTime) {
        if (dateTime == null) {
            return null;
        }

        return dateTime.toLocalDate().atTime(23, 59);
    }
}

Related

  1. areDatesOneMonthApart(LocalDateTime start, LocalDateTime end)
  2. atMidnight(LocalDateTime value)
  3. balanceStartAndEndDateTime(LocalDateTime startDateTime, LocalDateTime endDateTime)
  4. before(LocalDateTime time1, LocalDateTime time2)
  5. calcNextDayOfWeekFromLDT(LocalDateTime ldt, DayOfWeek dow)
  6. checkIfTimeExist(LocalDateTime date)
  7. clampDateTimeWithMaxAllowedHour(LocalDateTime dateTime, int maxAllowedHour)
  8. convertDatabaseDateToUSTime(LocalDateTime databaseDate)
  9. converterZoneDatetimeToLocalDateTime( final String date)