Here you can find the source of asEpochMilli(final LocalDate localDate)
Parameter | Description |
---|---|
localDate | LocalDate to convert |
public static long asEpochMilli(final LocalDate localDate)
//package com.java2s; /*/*from w ww.j a va 2 s .co m*/ * jGnash, a personal finance application * Copyright (C) 2001-2019 Craig Cavanaugh * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.time.LocalDate; import java.time.ZoneId; public class Main { private static final int MILLISECONDS_PER_SECOND = 1000; /** * Converts a LocaleDate into milliseconds from the epoch of 1970-01-01T00:00:00Z. * * @param localDate {@code LocalDate} to convert * @return and equivalent milliseconds from the epoch of 1970-01-01T00:00:00Z */ public static long asEpochMilli(final LocalDate localDate) { return localDate.atStartOfDay(ZoneId.systemDefault()).toEpochSecond() * MILLISECONDS_PER_SECOND; } }