List of utility methods to do Long to Year Convert
String | parseYearFromDate(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; |
int | getYear(long dateTimeMillis) get Year SimpleDateFormat format = new SimpleDateFormat("yyyy"); StringBuilder dateString = new StringBuilder( format.format(dateTimeMillis)); return Integer.parseInt(dateString.toString()); |