MonthDay getLong(TemporalField field) example

Description

MonthDay getLong(TemporalField field) gets the value of the specified field from this month-day 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.MonthDay;
import java.time.temporal.ChronoField;
// www .j  a  v  a2 s  .c o m
public class Main {
  public static void main(String[] args) {
    MonthDay m = MonthDay.now();
    long n = m.getLong(ChronoField.MONTH_OF_YEAR);
    System.out.println(n);

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset