Java Date Time - Year atDay(int dayOfYear) example








Year atDay(int dayOfYear) combines this year with a day-of-year to create a LocalDate.

Syntax

atDay has the following syntax.

public LocalDate atDay(int dayOfYear)

Example

The following example shows how to use atDay.

import java.time.LocalDate;
import java.time.Year;
// ww  w .  j  a v a2 s  .co m
public class Main {
  public static void main(String[] args) {
    Year y = Year.of(2014);
    LocalDate l = y.atDay(123);
    System.out.println(l);

  }
}

The code above generates the following result.