Java Day From days(int year, int month)

Here you can find the source of days(int year, int month)

Description

days

License

Open Source License

Declaration

public static int days(int year, int month) 

Method Source Code

//package com.java2s;

public class Main {

    public static int days(int year, int month) {
        int total = 30;
        switch (month) {
        case 1://  w  w  w .jav  a  2 s. co m
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            total = 31;
            break;
        case 2:
            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
                total = 29;
            else
                total = 28;
            break;
        default:
            break;
        }
        return total;
    }
}

Related

  1. dayFromDateValue(long x)
  2. dayNumberToTimestamp(short dateNumber)
  3. days(int d)
  4. days(int month, int year)
  5. days(int num)
  6. daysAfter(Date earlierDate, Date laterDate)
  7. daysAndHours(int hours)
  8. daysBetweenTime(long start, long end)
  9. daysInFebruary(int year)