List of utility methods to do Year Get
Date | getIndexYear(Date origin, int index) get Index Year Date dt = origin;
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(dt);
rightNow.add(Calendar.YEAR, index);
Date dt1 = rightNow.getTime();
return dt1;
|
int | getCurrentYear() get Current Year Calendar calendar = new GregorianCalendar(); calendar.setTime(new Date()); return calendar.get(Calendar.YEAR); |
String | getCurrentYear() get Current Year DateFormat tempDate = new SimpleDateFormat("yyyy"); return tempDate.format(new java.util.Date()); |
String | getCurrentYear() get Current Year return getFormatCurrentTime("yyyy"); |
String | getBeforeYear() get Before Year String currentYear = getFormatCurrentTime("yyyy"); int beforeYear = Integer.parseInt(currentYear) - 1; return "" + beforeYear; |
boolean | isInCurrentYear(long lTime) is In Current Year Calendar cal = Calendar.getInstance(); Calendar calUnknown = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); calUnknown.setTimeInMillis(lTime); int nDayOfYear = cal.get(Calendar.DAY_OF_YEAR); cal.add(Calendar.DAY_OF_YEAR, 0 - nDayOfYear); if (calUnknown.before(cal)) { return false; ... |
int | getCurrentYear() get Current Year CALENDAR.setTime(new Date()); return CALENDAR.get(Calendar.YEAR); |
int | getYear() get Year return Calendar.getInstance().get(Calendar.YEAR);
|
int | getYearByMillis(long millis) get Year By Millis Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(millis);
return calendar.get(Calendar.YEAR);
|