List of utility methods to do Calendar Year
Calendar | getStartOfWeekCalendar(final int year, final int weekOfYear, final Locale locale) get Start Of Week Calendar final Calendar cal = createCalendarInstance(locale);
cal.clear();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.WEEK_OF_YEAR, weekOfYear);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
...
|
Calendar | getValidCalendar(int year, int month, int day) Validate the actual date of the given date elements and returns a calendar instance based on the given date elements. return getValidCalendar(year, month, day, 0, 0, 0);
|
String | getWeekOfYear(Calendar currentDate) Method getWeekOfYear. int temp = 0; String result = ""; temp = currentDate.get(Calendar.WEEK_OF_YEAR); result = String.valueOf(temp).trim(); result = padString(result, false, 2, "0"); return result; |
int | getWeekOfYear(int startDay, Calendar dt) Calculates week number for given date This function is derived from JavaScript implementation used in OE int offset = (((Math.abs(startDay - 6)) + 5) % 7); Calendar d3 = new GregorianCalendar(dt.get(Calendar.YEAR), dt.get(Calendar.MONTH), dt.get(Calendar.DATE), 0, 0, 0); d3.set(Calendar.MILLISECOND, 0); d3.add(Calendar.DAY_OF_YEAR, offset); double DC3 = d3.getTimeInMillis() / ms1d; double AWN = Math.floor(DC3 / 7); Calendar yCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); ... |
int | getWeekOfYearYear(GregorianCalendar cal) get Week Of Year Year int y = cal.get(Calendar.YEAR); int m = cal.get(Calendar.MONTH) + 1 - Calendar.JANUARY; int w = cal.get(Calendar.WEEK_OF_YEAR); if (w == 1 && m == 12) return y + 1; if (w > 50 && m == 1) return y - 1; return y; ... |
String | getYear(Calendar cal) get Year return String.valueOf(cal.get(Calendar.YEAR));
|
int | getYear(Calendar calendar) Get the year (positive or negative) from a calendar. int year = calendar.get(Calendar.YEAR); if (calendar.get(Calendar.ERA) == GregorianCalendar.BC) { year = 1 - year; return year; |
int | getYear(Calendar calendar) get Year return calendar.get(Calendar.YEAR);
|
int | getYear(Calendar calendar) get Year return calendar.get(Calendar.YEAR);
|
int | getYear(Date date, Calendar cal) get Year cal.setTime(date);
return cal.get(Calendar.YEAR);
|