Java Month monthMillis(int year, int monthNum)

Here you can find the source of monthMillis(int year, int monthNum)

Description

month Millis

License

Apache License

Declaration

public static long monthMillis(int year, int monthNum) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static long monthMillis(int year, int monthNum) {

        if (monthNum == 13) {
            year += 1;/*from  ww w .j av  a  2s.  co m*/
            monthNum = 0;
        }

        monthNum += 1;

        if (monthNum == 2) {
            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
                return (long) 1000 * 60 * 60 * 24 * 29;
            } else {
                return (long) 1000 * 60 * 60 * 24 * 28;
            }
        } else if (monthNum == 1 || monthNum == 3 || monthNum == 5 || monthNum == 7 || monthNum == 8
                || monthNum == 10 || monthNum == 12) {
            return (long) 1000 * 60 * 60 * 24 * 31;
        } else {
            return (long) 1000 * 60 * 60 * 24 * 30;
        }
    }
}

Related

  1. month2String(int month)
  2. monthAlphaToNum(String str)
  3. monthDiff(String beforeTime, String endTime)
  4. monthFromDateValue(long x)
  5. monthLength(int year, int month)
  6. monthStringToInteger(String month)
  7. MonthText(int iIndex)
  8. monthToTerm(int month)
  9. nextMonth(String s)