Close

Java Date Time - Year.atDay() 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 atDay(int dayOfYear)

This method combines the copy of this year with the specified day-of-year and returns a LocalDate. The valid value of dayOfYear is between 1-365 (or 1-366 for a leap year) inclusively.


Examples


package com.logicbig.example.year;

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

public class AtDayExample {

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

LocalDate d = y.atDay(210);
System.out.println(d);
}
}

Output

2011
2011-07-29




See Also