Java Date Time - MonthDay atYear(int year) example








MonthDay atYear(int year) combines this month-day with a year to create a LocalDate.

Syntax

atYear has the following syntax.

public LocalDate atYear(int year)

Example

The following example shows how to use atYear.

import java.time.LocalDate;
import java.time.MonthDay;
/*from   www.  ja v  a2 s.  c  o  m*/
public class Main {
  public static void main(String[] args) {
    MonthDay m = MonthDay.now();
    LocalDate n = m.atYear(1990);
    System.out.println(n);

  }
}

The code above generates the following result.