List of utility methods to do Week
String | getWeekFirst(String format) get Week First Calendar c = Calendar.getInstance(); int days = getDayInWeek(); c.add(GregorianCalendar.DATE, 2 - ((days == 1) ? 8 : days)); SimpleDateFormat sf = new SimpleDateFormat(format); return sf.format(c.getTime()); |
String | getWeekFromDate(String dateString) get Week From Date StringBuffer sb = new StringBuffer(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); try { Date date = format.parse(dateString); Date mondy = new Date(); Date sundy = new Date(); int day = date.getDay(); if (day == 0) { ... |
Integer | getWeekId(String date) get Week Id Date d = new Date(); try { d = yyyyMMdd.parse(date); } catch (ParseException e) { Calendar calendar = Calendar.getInstance(); calendar.setTime(d); Integer i = calendar.get(Calendar.DAY_OF_WEEK) - 1; ... |
int | getWeekInMonth() get Week In Month Calendar c = Calendar.getInstance(); int week = c.get(Calendar.WEEK_OF_MONTH); return week; |
String | getWeekName() get Week Name return getCurrentTime("yyyy") + getWeekOfYear(); |
int | getWeekNumber(String sdate) get Week Number Date date = strToDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_WEEK);
|
String | getWeekNumberFromDate(String thedate) get Week Number From Date String strReturn = ""; SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String dateStringToParse = thedate; try { Date date = bartDateFormat.parse(dateStringToParse); SimpleDateFormat bartDateFormat2 = new SimpleDateFormat("yyyy-MM-dd EEEE"); strReturn = bartDateFormat2.format(date); } catch (Exception ex) { ... |
int | getWeekNumByDate(String date) get Week Num By Date SimpleDateFormat format = new SimpleDateFormat(DF_YMD); try { Date d = format.parse(date); Calendar cal = Calendar.getInstance(); cal.setTime(d); int num = cal.get(Calendar.DAY_OF_WEEK) - 1; return num; } catch (ParseException e) { ... |
Integer | getWeekNumner(String date) get Week Numner Integer weekNumber = 0; try { if (date.equals("")) { return weekNumber; DateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd"); Date passedDate = formatter.parse(date); Calendar cal = Calendar.getInstance(); ... |
int | getWeekOfMonth() Used to know what week of the month it is to display a different image on the main page Calendar cal = Calendar.getInstance();
return cal.get(Calendar.WEEK_OF_MONTH);
|