Java Utililty Methods Year Current

List of utility methods to do Year Current

Description

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

Method

intgetCurrentYear()
Answer the current year
return (new GregorianCalendar()).get(Calendar.YEAR);
intgetCurrentYear()

Returns the current year from the system Calendar calendar .

int returnValue;
returnValue = Calendar.getInstance().get(Calendar.YEAR);
return returnValue;
intgetCurrentYear()
get Current Year
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
return cal.get(Calendar.YEAR);
DategetCurrentYearFirst()
get Current Year First
Calendar today = Calendar.getInstance();
int yearPlus = Calendar.getInstance().get(Calendar.YEAR);
today.set(yearPlus, 1, 1);
return new Date(today.getTimeInMillis());
StringgetCurrentYearMonth()
get Current Year Month
int year = getCurrentYear();
int month = getCurrentMonth();
String yearMonth = "";
if (month >= 10) {
    yearMonth = String.valueOf(year) + String.valueOf(month);
} else {
    yearMonth = String.valueOf(year) + "0" + String.valueOf(month);
return yearMonth;
int[]getCurrentYearMonthDay()
get Current Year Month Day
return getYearMonthDay(new Date());
intgetCurrYear()
get Curr Year
return new GregorianCalendar().get(Calendar.YEAR);
DategetCurrYearFirst()
get Curr Year First
Calendar currCal = Calendar.getInstance();
int currentYear = currCal.get(Calendar.YEAR);
return getYearFirst(currentYear);
DategetLastDayOfCurrentYear()
Return first day of current year
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, 11);
cal.set(Calendar.DAY_OF_MONTH, 31);
return cal.getTime();
intgetYear()
get Year
return getYear(now());