Java Date to LocalDateTime toLocalDateTime(Date date)

Here you can find the source of toLocalDateTime(Date date)

Description

to Local Date Time

License

Creative Commons License

Declaration

public static LocalDateTime toLocalDateTime(Date date) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;

import java.util.Date;

public class Main {
    public static LocalDateTime toLocalDateTime(Date date) {
        if (date == null) {
            return null;
        }//from  ww  w.ja va 2s  .co m
        Instant instant = Instant.ofEpochMilli(date.getTime());
        return LocalDateTime.ofInstant(instant, getZoneId());
    }

    private static ZoneId getZoneId() {
        return ZoneId.systemDefault();
    }
}

Related

  1. toLocalDateTime(BigDecimal comTime)
  2. toLocalDateTime(Date date)
  3. toLocalDateTime(Date date)
  4. toLocalDateTime(Date dateTime)
  5. toLocalDateTime(Date utilDate)