MonthDay atYear(int year) example

Description

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;
/*ww w . j  a  v a 2 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.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset