LocalDateTime getLong(TemporalField field) example
Description
LocalDateTime getLong(TemporalField field)
gets the value of
the specified field from this date-time as a long.
Syntax
getLong
has the following syntax.
public long getLong(TemporalField field)
Example
The following example shows how to use getLong
.
import java.time.LocalDateTime;
import java.time.temporal.ChronoField;
/*from ww w .j av a 2 s .co m*/
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 01);
System.out.println(a.getLong(ChronoField.DAY_OF_WEEK));
}
}
The code above generates the following result.