java.util.Date to Local Date Using Default Zone - Java java.time

Java examples for java.time:Timezone

Description

java.util.Date to Local Date Using Default Zone

Demo Code


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

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

public class Main {
    public static LocalDate toLocalDateUsingDefaultZone(Date dateTime) {
        return LocalDate.from(dateTime.toInstant().atZone(
                ZoneId.systemDefault()));
    }//from  ww w.  ja  v a 2  s. co m
}

Related Tutorials