Java Year From yearFromDateValue(long x)

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

Description

Get the year from a date value.

License

Open Source License

Parameter

Parameter Description
x the date value

Return

the year

Declaration

public static int yearFromDateValue(long x) 

Method Source Code

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

public class Main {
    private static final int SHIFT_YEAR = 9;

    /**//from  w  w w.  j av  a 2  s .  c  o m
     * Get the year from a date value.
     *
     * @param x the date value
     * @return the year
     */
    public static int yearFromDateValue(long x) {
        return (int) (x >>> SHIFT_YEAR);
    }
}

Related

  1. year()
  2. year(Date date)
  3. year(long time)
  4. yearformMatDate(Date date)
  5. yearFromDate(String date)
  6. yearFromFileName(String str)
  7. yearOfDate(Date s)
  8. yearsBetween(String from, String to)