List of utility methods to do Year Get
int | getYear(Date d) Get the year from a Date object. return Integer.parseInt(new SimpleDateFormat("yyyy").format(d)); |
int | getYear(Date date) get Year calendar.setTime(date);
return calendar.get(Calendar.YEAR);
|
int | getYear(Date date) get Year final GregorianCalendar utcCalendar = createUtcCalendar(date); return utcCalendar.get(Calendar.YEAR); |
int | getYear(Date date) get Year return getDatePar(Calendar.YEAR, date);
|
String | getYear(Date date) get Year return new SimpleDateFormat("yyyy").format(date); |
String | getYear(Date date) get Year DateFormat df = new SimpleDateFormat("yyyy"); df.setLenient(false); return df.format(date); |
String | getYear(Date date) get Year return FormatDate(date, "yyyy"); |
int | getYear(Date date) get Year return getCalendar(date).get(Calendar.YEAR);
|
int | getYear(Date date, TimeZone timeZone) get Year if (date == null) throw new IllegalArgumentException("date is required."); if (timeZone == null) timeZone = TimeZone.getDefault(); _fmtYear.setTimeZone(timeZone); try { return Integer.parseInt(_fmtYear.format(date)); } catch (NumberFormatException e) { ... |
String | getYear(Date dt) Get year string for the specified date. SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); StringBuffer sb = new StringBuffer(); sdf.format(dt, sb, new FieldPosition(0)); return sb.toString(); |