Here you can find the source of dateToLong(LocalDateTime date)
Parameter | Description |
---|---|
date | The date |
public static long dateToLong(LocalDateTime date)
//package com.java2s; //License from project: Open Source License import java.time.LocalDateTime; import java.time.ZoneOffset; public class Main { /**/*from w w w . j a v a 2 s . com*/ * Convert a UTC {@link LocalDateTime} to a {@code long} * milliseconds value for storage in the database * @param date The date * @return The long value */ public static long dateToLong(LocalDateTime date) { return date.toInstant(ZoneOffset.UTC).toEpochMilli(); } }