List of utility methods to do Year Get
int | getYear(final Date date) get Year if (date == null) { return 0; Calendar cal = new GregorianCalendar(); cal.setTime(date); return cal.get(Calendar.YEAR); |
String | getYear(final String date) get Year String year = null; if (date != null && !date.isEmpty()) { final DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.ENGLISH); final Calendar cal = Calendar.getInstance(Locale.ENGLISH); cal.setTime(df.parse(date)); year = String.valueOf(cal.get(Calendar.YEAR)); return year; ... |
String | getYear(final String date) DOCUMENT ME! return date.substring(6);
|
String | getYear(int year) get Year return Integer.toString(year);
|
int | getYear(long date) get Year return (int) (date / YEAR_OFFSET); |
int | getYear(String aDate) get Year int myYear = -1; if (isValidObjectModelDate(aDate)) { Integer Year = new Integer(aDate.substring(0, 4)); myYear = Year.intValue(); return myYear; |
String | GetYear(String agmipDate) Get Year Date date = apsim.parse(agmipDate); Calendar c = Calendar.getInstance(); c.setTime(date); return c.get(Calendar.YEAR) + ""; |
int | getYear(String argDate) This method is used to retrieve the year SimpleDateFormat dtFormat = new SimpleDateFormat("MM/dd/yyyy"); Calendar calendar = Calendar.getInstance(); int year = 0; try { calendar.setTime(dtFormat.parse(argDate)); year = calendar.get((Calendar.YEAR)) - 1; } catch (ParseException eParse) { return year; |
Integer | getYear(String date) get Year if (date == null) { return null; String year = null; if (date.contains(".")) { year = date.substring(date.lastIndexOf('.') + 1); } else if (date.contains("-")) { year = date.substring(0, date.indexOf('-')); ... |
int | getYear(String date) get Year date = deleteSlash(date);
date = deleteDash(date);
return Integer.parseInt(date.substring(0, 4));
|