now from LocalDate - Java java.time

Java examples for java.time:LocalDate

Description

now from LocalDate

Demo Code


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

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

public class Main {
    public static Date now() {
        return localDateToDate(LocalDate.now());
    }//from www  .  ja  v a2 s  .co m

    public static Date localDateToDate(LocalDate localDate) {
        return Date.from(localDate.atStartOfDay(ZoneId.systemDefault())
                .toInstant());
    }
}

Related Tutorials