Java Date Time - MonthDay get(TemporalField field) example

MonthDay get(TemporalField field) gets the value of the specified field from this month-day as an int.


get has the following syntax.

public int get(TemporalField field)


The following example shows how to use get.

import java.time.MonthDay;
import java.time.temporal.ChronoField;
//  w  w w.j ava2  s  .  c o m
public class Main {
  public static void main(String[] args) {
    MonthDay m =;
    long n = m.get(ChronoField.MONTH_OF_YEAR);


The code above generates the following result.