LocalDate of(int year, Month month, int dayOfMonth) example

Description

LocalDate of(int year, Month month, int dayOfMonth) creates an instance of LocalDate from a year, month and day.

Syntax

of has the following syntax.


public static LocalDate of(int year,   Month month,   int dayOfMonth)

Example

The following example shows how to use of.


import java.time.LocalDate;
import java.time.Month;
//from   ww w  . jav  a  2  s  .  c om
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014,Month.APRIL,10);
    
    System.out.println(a);
  }
}

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