Java Date to LocalDateTime toLocalDateTime(Date utilDate)

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

Description

to Local Date Time

License

Apache License

Declaration

public static LocalDateTime toLocalDateTime(Date utilDate) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;

public class Main {
    public static LocalDateTime toLocalDateTime(Date utilDate) {
        if (utilDate == null) {
            return null;
        }//from  w  w w  .  j a v a  2s.c o m
        ZonedDateTime zonedDateTime = toZonedDateTime(utilDate);
        return zonedDateTime.toLocalDateTime();
    }

    public static ZonedDateTime toZonedDateTime(Date utilDate) {
        if (utilDate == null) {
            return null;
        }
        final ZoneId systemDefault = ZoneId.systemDefault();
        return ZonedDateTime.ofInstant(utilDate.toInstant(), systemDefault);
    }
}

Related

  1. toLocalDateTime(BigDecimal comTime)
  2. toLocalDateTime(Date date)
  3. toLocalDateTime(Date date)
  4. toLocalDateTime(Date date)
  5. toLocalDateTime(Date dateTime)
  6. toLocalDateTime(long timestamp)
  7. toLocalDateTime(String date, int time)
  8. toLocalDateTime(String dateValue, String timeValue)
  9. toLocalDateTime(String string)