get Instant from LocalDate - Java java.time

Java examples for java.time:Instant

Description

get Instant from LocalDate

Demo Code


//package com.java2s;

import java.time.Instant;
import java.time.LocalDate;

import java.time.ZoneId;

public class Main {
    private static final ZoneId DEFAULT_ZONE_ID = ZoneId
            .of("Asia/Singapore");

    public static Instant getInstant(LocalDate localDate) {
        return localDate.atStartOfDay().atZone(DEFAULT_ZONE_ID).toInstant();
    }//  w  ww.ja va  2s  .co  m
}

Related Tutorials