Android Long to Year Convert getYear(long dateTimeMillis)

Here you can find the source of getYear(long dateTimeMillis)

Description

get Year

License

Open Source License

Declaration

public static int getYear(long dateTimeMillis) 

Method Source Code

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

import java.text.SimpleDateFormat;

public class Main {
    public static int getYear(long dateTimeMillis) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy");
        StringBuilder dateString = new StringBuilder(
                format.format(dateTimeMillis));
        return Integer.parseInt(dateString.toString());
    }//from   w  w  w.ja  v  a  2 s . c  o  m
}

Related

  1. parseYearFromDate(String longDate)