Android Utililty Methods Long to Year Convert

List of utility methods to do Long to Year Convert

Description

The list of methods to do Long to Year Convert are organized into topic(s).

Method

StringparseYearFromDate(String longDate)
Return the release year from a date on the format "YYYY-MM-DD".
if (longDate == null)
    return null;
int index = longDate.indexOf("-");
return (index != -1) ? longDate.substring(0, index) : longDate;
intgetYear(long dateTimeMillis)
get Year
SimpleDateFormat format = new SimpleDateFormat("yyyy");
StringBuilder dateString = new StringBuilder(
        format.format(dateTimeMillis));
return Integer.parseInt(dateString.toString());