Java LocalDateTime to convertToDate(LocalDateTime dateTime)

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

Description

convert To Date

License

Open Source License

Declaration

public static Date convertToDate(LocalDateTime dateTime) 

Method Source Code


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

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

public class Main {
    public static Date convertToDate(LocalDateTime dateTime) {
        ZonedDateTime zdt = dateTime.atZone(ZoneId.systemDefault());
        return Date.from(zdt.toInstant());
    }/*from  w  w  w .j  a v a  2s.  c o m*/
}

Related

  1. convertLocalDateTimeToDateInUTC(final LocalDateTime ldt)
  2. fromLocalDateTime(LocalDateTime _ldt)
  3. getDate(LocalDateTime time)
  4. getDateTimeText(LocalDateTime dateTime)
  5. getDelayUntil(final LocalDateTime ldt)