List of utility methods to do Year Get
String | getYear(String strDate) get Year String year = ""; if (strDate != null && !strDate.equals("")) { strDate = strDate.trim(); year = getElement(strDate.split("-"), 0); return year; |
Date | getYear(String string) Returns the year given a string in format yyyy. if (string == null) { return null; Date date = null; try { date = (new SimpleDateFormat("yyyy").parse(string)); } catch (ParseException ex) { return null; ... |
String | getYear(String tempdat, Locale locale) This method parses the @param String tempdat, according to a specified format style determined by the @param Locale locale to a Date. DateFormat df = DateFormat.getDateInstance(DateFormat.FULL, locale); Date d = df.parse(tempdat, new ParsePosition(0)); Calendar cal_date = new GregorianCalendar(); cal_date.setTime(d); int jahr = 0; jahr = cal_date.get(Calendar.YEAR); String jahrstr = String.valueOf(jahr); return jahrstr; ... |
String | getYear(String[] contents) get Year return contents[0];
|
int | getYearCount(String from, String to) get Year Count return getYearCount(from, to, DATE_FORMAT.toPattern());
|
Date | getYearEnd(Date date) get Year End String newDateStr = FormatDate(date, "yyyy") + "-12-31"; return stringToDateShort(newDateStr); |
int | getYearForDate(String dateToCheck, String pattern) Parses a string into a date. if (isDateValid(dateToCheck, pattern) && dateToCheck.length() == pattern.length()) { int index = pattern.indexOf("yyyy"); if (index == -1) { return (-1); String year_str = dateToCheck.substring(index, index + 4); int year = -1; try { ... |
ArrayList | getYearList(int years) get Year List ArrayList<String> yearList = new ArrayList<>(years); int startYear = Calendar.getInstance().get(Calendar.YEAR); for (int i = 0; i < years; i++) yearList.add(Integer.toString(startYear + i)); return yearList; |
String | getYearLongDesc(Date year) This method is used for getting year long description SimpleDateFormat sdf = new SimpleDateFormat(); sdf.applyPattern("yyyy"); return sdf.format(year); |
List | getYearlyIntervals(Date start, Date end) get Yearly Intervals List<Date> intervals = new ArrayList<Date>(); GregorianCalendar c = new GregorianCalendar(); c.setTime(start); int startYear = c.get(Calendar.YEAR); int year = startYear; intervals.add(start); while (true) { year++; ... |