Java LocalDate Calculate localDateToSystemAdjustedStartOfDayDate(LocalDate d)

Here you can find the source of localDateToSystemAdjustedStartOfDayDate(LocalDate d)

Description

Adjusts a LocalDate to Midnight of the say day (start of day).

License

Open Source License

Parameter

Parameter Description
d a parameter

Exception

Parameter Description
Exception an exception

Declaration

public static Date localDateToSystemAdjustedStartOfDayDate(LocalDate d) throws Exception 

Method Source Code


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

import java.time.*;

import java.util.Date;

public class Main {
    /**//from  w  w  w  . ja v  a 2s  . co m
     * Adjusts a LocalDate to Midnight of the say day (start of day).
     *
     * @param d
     * @return
     * @throws Exception
     */
    public static Date localDateToSystemAdjustedStartOfDayDate(LocalDate d) throws Exception {
        LocalDateTime ldt = d.atStartOfDay();
        return getSystemDefaultDate(ldt);
    }

    /**
     * Get local system Date from LocalDateTime
     *
     * @param ldt
     * @return
     * @throws Exception
     */
    public static Date getSystemDefaultDate(LocalDateTime ldt) throws Exception {
        return Date.from(ldt.atZone(ZoneId.systemDefault()).toInstant());
    }
}

Related

  1. isWeekend(LocalDate date)
  2. isWorkDay(@Nonnull final LocalDate aDate)
  3. lastMonth(LocalDate date)
  4. localDate2ms(final LocalDate ld)
  5. LocalDateFromMilli(long value)
  6. max(ChronoLocalDate date1, ChronoLocalDate date2)
  7. medTime(LocalDate date, String text)
  8. minusDaysAdjustedToStartOfDay(LocalDate ld, int days)
  9. newToOld(LocalDate d)