Java SQL LocalDate asLocalDate(java.util.Date date, ZoneId zone)

Here you can find the source of asLocalDate(java.util.Date date, ZoneId zone)

Description

as Local Date

License

Open Source License

Declaration

public static LocalDate asLocalDate(java.util.Date date, ZoneId zone) 

Method Source Code

//package com.java2s;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;

public class Main {
    public static LocalDate asLocalDate(java.util.Date date) {
        return asLocalDate(date, ZoneId.systemDefault());
    }/*from  w  w  w .j av a 2s .co m*/

    public static LocalDate asLocalDate(java.util.Date date, ZoneId zone) {
        if (date == null)
            return null;

        if (date instanceof java.sql.Date)
            return ((java.sql.Date) date).toLocalDate();
        else
            return Instant.ofEpochMilli(date.getTime()).atZone(zone)
                    .toLocalDate();
    }
}

Related

  1. add(Date awal, int i)
  2. addDays(final Date date, final int daysToAdd)
  3. asLocalDate(Date date)
  4. asLocalDate(Date date)
  5. asUtilDate(Object date)
  6. asUtilDate(Object date, ZoneId zone)
  7. convertLocalDateToDatabaseDate(LocalDate localDate)
  8. getDay(Date date)