get Timestamp From LocalDate - Java java.time

Java examples for java.time:LocalDate

Description

get Timestamp From LocalDate

Demo Code


//package com.java2s;

import java.time.LocalDate;

import java.util.TimeZone;

public class Main {
    public static long getTimestampFromDate(LocalDate date) {
        if (date == null)
            return 0;
        return date.atStartOfDay(TimeZone.getDefault().toZoneId())
                .toEpochSecond();//from  w w w. j  a  v a  2 s  .co  m
    }
}

Related Tutorials