Month firstDayOfYear(boolean leapYear) example

Description

Month firstDayOfYear(boolean leapYear) gets the day-of-year corresponding to the first day of this month.

Syntax

firstDayOfYear has the following syntax.


public int firstDayOfYear(boolean leapYear)

Example

The following example shows how to use firstDayOfYear.


import java.time.LocalDate;
import java.time.Month;
// w ww. jav  a2s.  c  o  m
public class Main {
  public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());
    
    System.out.println(m.firstDayOfYear(false));

  }
}

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