Java Date Time Java Java API
java.time.LocalDate
public long getLong(TemporalField field)
This method extracts and returns the specified temporal field value as long.
This method is different from get(TemporalField) in that it won't throw UnsupportedTemporalTypeException for fields EPOCH_DAY and PROLEPTIC_MONTH.
It will also throw the exception for the field which returns false from LocalDate.isSupported(TemporalField) method.
LocalDate.isSupported(TemporalField)
This method is defined in the interface, TemporalAccessor
package com.logicbig.example.localdate;import java.time.LocalDate;import java.time.temporal.ChronoField;public class GetLongExample { public static void main (String... args) { long l = LocalDate.of(2012, 11, 15) .getLong(ChronoField.EPOCH_DAY); System.out.println(l); }}
15659