Close

Java Date Time - Year.atMonthDay() Examples

Java Date Time Java Java API 


Class:

java.time.Year

java.lang.Objectjava.lang.Objectjava.time.Yearjava.time.Yearjava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.lang.ComparableComparablejava.io.SerializableSerializableLogicBig

Method:

public LocalDate atMonthDay(MonthDay monthDay)

The method combines the copy of this year object with the specified monthDay object to create a LocalDate.


Examples


package com.logicbig.example.year;

import java.time.LocalDate;
import java.time.MonthDay;
import java.time.Year;

public class AtMonthDayExample {

public static void main(String... args) {
Year y = Year.of(2011);
System.out.println(y);

MonthDay m = MonthDay.of(11, 3);
System.out.println(m);

LocalDate d = y.atMonthDay(m);
System.out.println(d);
}
}

Output

2011
--11-03
2011-11-03




See Also