List of utility methods to do Day
Date | getDay(String string) Returns the day given a string in format dd-MMM-yyyy. if (string == null) { return null; Date date = null; try { date = (new SimpleDateFormat("dd-MMM-yyyy").parse(string)); } catch (ParseException ex) { return null; ... |
String | getDay(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 tag = 0; tag = cal_date.get(Calendar.DATE); String tagstr = String.valueOf(tag); return tagstr; ... |
String | getDayAfter(String dateformat, String day, int filed, int delta) get Day After Calendar c = Calendar.getInstance(); Date date = null; try { date = new SimpleDateFormat(dateformat).parse(day); } catch (ParseException e) { c.setTime(date); int iday = c.get(filed); ... |
String | getDayAfterTommorrowsDateFne() Gets the day after tommorrows date fne. DateFormat formatter = new SimpleDateFormat("MMM"); SimpleDateFormat monthParse = new SimpleDateFormat("MM"); DateFormat dformatter = new SimpleDateFormat("DD"); SimpleDateFormat dateParse = new SimpleDateFormat("DD"); Calendar cal = Calendar.getInstance(); String month = Integer.toString(cal.get(Calendar.MONTH) + 1); String date = Integer.toString(cal.get(Calendar.DATE) + 2); try { ... |
String | getDayBefore(Date date) get Day Before Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 1);
return pattern(DEFAULT_PATTERN, cal.getTime());
|
Date | getDayBegin(Date date) get Day Begin DateFormat df = new SimpleDateFormat("yyyyMMdd"); df.setLenient(false); String dateString = df.format(date); try { return df.parse(dateString); } catch (ParseException e) { return null; |
long | getDayBetween(String firstDay, String secondDay) get Day Between long dayBetween = 0L; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); try { Date firstDate = simpleDateFormat.parse(firstDay); Date secondDate = simpleDateFormat.parse(secondDay); dayBetween = (firstDate.getTime() - secondDate.getTime()) / 0x5265c00L; } catch (ParseException e) { dayBetween = 0L; ... |
Date | getDayDate(String date, String formatFormat) get Day Date Calendar cal = Calendar.getInstance();
cal.setTime(strToDate(date, formatFormat));
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
return cal.getTime();
|
String | getDayDesc(Date arg) This method is used for getting the description corresponding to Calendar day SimpleDateFormat sdf = new SimpleDateFormat(); sdf.applyPattern("dd"); return sdf.format(arg).toUpperCase(); |
Date | getDayEnd(Date date) get Day End DateFormat df = new SimpleDateFormat("yyyyMMdd"); df.setLenient(false); String dateString = df.format(date); dateString += "235959"; try { return parseDateLongFormat(dateString); } catch (Exception e) { return date; ... |