convert LocalDate To Date as default time zone - Java java.time

Java examples for java.time:Timezone

Description

convert LocalDate To Date as default time zone

Demo Code


//package com.java2s;

import java.time.LocalDate;

import java.time.ZoneId;

import java.util.Date;

public class Main {
    public static Date convertToDate(LocalDate localDate) {
        Date date = Date.from(localDate
                .atStartOfDay(ZoneId.systemDefault()).toInstant());

        return date;
    }/*from   w  w  w.  ja v a  2s .co  m*/
}

Related Tutorials