Java Utililty Methods Year Get

List of utility methods to do Year Get

Description

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

Method

IntegercalcDifferenceAsYears(Calendar aBaseDate, Calendar aTargetDate)
calc Difference As Years
if (aBaseDate.getTimeInMillis() > aTargetDate.getTimeInMillis()) {
    return -1 * calcDifferenceAsYearsPrivate(aTargetDate, aBaseDate);
} else {
    return calcDifferenceAsYearsPrivate(aBaseDate, aTargetDate);
IntegercurrentYear()
current Year
return Integer.parseInt(yyyy.format(new Date()));
StringcurrentYear()
current Year
formatter = new SimpleDateFormat("yyyy");
return formatter.format(new Date());
StringcurrentYearStr()
current Year Str
return getTimeForMormat(new Date(), FORMAT_YEAR);
StringgetBeforeYear()
get Before Year
String currentYear = getFormatCurrentTime("yyyy");
int beforeYear = Integer.parseInt(currentYear) - 1;
return "" + beforeYear;
DategetBeginningOfYear()
get Beginning Of Year
return getBeginningOfYear(null);
StringgetCalendarYearString(Calendar date)
returns day from a calendar date
return justYear.format(date.getTime());
intgetCurrentYear()
get Current Year
return getYear(new Date());
intgetCurrentYearAsInt()
get Current Year As Int
return CURRENT_YEAR_AS_INT;
intgetCurrYearFirst()
get Curr Year First
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar ca = Calendar.getInstance();
int FirstYear = ca.get(Calendar.YEAR);
return FirstYear;