List of utility methods to do Day
String | getDayEndTime(int off, String timezone) get Day End Time Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(new Date().getTime()); calendar.add(5, off); SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd 23:59:59"); dateFormatGmt.setTimeZone(TimeZone.getTimeZone(timezone)); return dateFormatGmt.format(calendar.getTime()); |
int | getDayForDate(String dateToCheck, String pattern) Parses a string into a date. if (isDateValid(dateToCheck, pattern) && dateToCheck.length() == pattern.length()) { int index = pattern.indexOf("dd"); if (index == -1) { return (-1); String day_str = dateToCheck.substring(index, index + 2); int day = -1; try { ... |
String | getDayFormat(Date date) get Day Format return dayFormater.format(date);
|
String[] | getDayInWeekBeginAndEnd(Date date) get Day In Week Begin And End java.util.Calendar cal = java.util.Calendar.getInstance(); cal.setTime(date); int week = cal.get(java.util.Calendar.DAY_OF_WEEK) - 1; String begin, end; if (week == 0) { begin = addDate(date, -6); end = format(date); } else { ... |
List | getDayInWeekForMonthIn2Characters(int year, int month) get Day In Week For Month In Characters SimpleDateFormat df = new SimpleDateFormat("EE"); List<String> list = new ArrayList<String>(); Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DATE, 1); while (cal.get(Calendar.MONTH) == month) { list.add(df.format(cal.getTime())); ... |
String | getDayName(String dateString) get Day Name String returnString; java.util.Date date = getDate(dateString); SimpleDateFormat sdf = new SimpleDateFormat("dd"); returnString = sdf.format(date); return returnString; |
String | getDayNameForDate(java.util.Date dt, boolean fullname) Gets the name of a day based on a date and current locale. final String fullFormat = "EEEE"; final String smallFormat = "EEE"; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(fullname ? fullFormat : smallFormat); String dayName = simpleDateFormat.format(dt); return (dayName); |
List | getDayNames(Locale locale) Returns a List of day name Strings - suitable for calendar headings. Calendar tempCal = Calendar.getInstance(locale); tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek()); SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", locale); List<String> resultList = new ArrayList<String>(); for (int i = 0; i < 7; i++) { resultList.add(dateFormat.format(tempCal.getTime())); tempCal.roll(Calendar.DAY_OF_WEEK, 1); return resultList; |
String | getDayNumber() Get the number of the current day Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("dd"); String output = format.format(date); return output; |
Integer | getDayOfDate(Date date) get Day Of Date return Integer.valueOf(yyyyMMddFormat.format(date));
|