Java Day Of Year dayOfYear(final int year, final int month, final int day)

Here you can find the source of dayOfYear(final int year, final int month, final int day)

Description

day Of Year

License

Open Source License

Declaration

public static int dayOfYear(final int year, final int month, final int day) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int dayOfYear(final int year, final int month, final int day) {
        int day_of_year;
        if (isLeapYear(year)) {
            day_of_year = 275 * month / 9 - (month + 9) / 12 + day - 30;
        } else {//from   ww  w  .  j av  a 2  s  . c  o  m
            day_of_year = 275 * month / 9 - ((month + 9) / 12 << 1) + day - 30;
        }
        return day_of_year;
    }

    public static boolean isLeapYear(final int y) {
        boolean result = false;
        if (y % 4 == 0 && (y < 1582 || y % 100 != 0 || y % 400 == 0)) {
            result = true;
        }
        return result;
    }
}

Related

  1. currentYearMonthDay()
  2. dateOfYearBetween(final int month, final int dayOfMonth, final int fromMonth, final int fromDayOfMonth, final int toMonth, final int toDayOfMonth)
  3. dayOfYear(int month, int day, int year)
  4. dayOfYear(int year, int month, int date)
  5. dayOfYear(int year, int month, int day)
  6. dayOfYear(int year, int month, int day)