Java Month monthFromDateValue(long x)

Here you can find the source of monthFromDateValue(long x)

Description

Get the month from a date value.

License

Open Source License

Parameter

Parameter Description
x the date value

Return

the month (1..12)

Declaration

public static int monthFromDateValue(long x) 

Method Source Code

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

public class Main {
    private static final int SHIFT_MONTH = 5;

    /**//  w w w . j a  va 2 s. co  m
     * Get the month from a date value.
     *
     * @param x the date value
     * @return the month (1..12)
     */
    public static int monthFromDateValue(long x) {
        return (int) (x >>> SHIFT_MONTH) & 15;
    }
}

Related

  1. month2int(String month)
  2. month2second(int month)
  3. month2String(int month)
  4. monthAlphaToNum(String str)
  5. monthDiff(String beforeTime, String endTime)
  6. monthLength(int year, int month)
  7. monthMillis(int year, int monthNum)
  8. monthStringToInteger(String month)
  9. MonthText(int iIndex)