List of utility methods to do SQL Date Get
long | getDateAsLong(ResultSet rset, Enum field) get Date As Long return getDateAsLong(rset, field.name());
|
long | getDateAsLong(Timestamp date) Gets the date as long. return date == null ? -1 : date.getTime();
|
Date | getDateBefore(Date date, Integer before) get Date Before if (before == 0) { return new Date(date.getTime()); Date d = new Date(date.getTime()); for (int i = 0; i < before; i++) { d.setTime(d.getTime() - 86400000); return d; ... |
Date | getDateBeforTwelveMonth() get Date Befor Twelve Month String date = ""; Calendar cla = Calendar.getInstance(); cla.setTime(getCurrentDate()); int year = cla.get(Calendar.YEAR) - 1; int month = cla.get(Calendar.MONTH) + 1; if (month > 9) { date = String.valueOf(year) + DATE_DIVISION + String.valueOf(month) + DATE_DIVISION + "01"; } else { ... |
String | getDateByNum(String dateNum) get Date By Num SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String date = sdf.format(new Date((long) (Double.parseDouble(dateNum) * 1000))); return date; |
Date | getDateByYearAndMonth(int year, int month) get Date By Year And Month Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); Date date = new Date(calendar.getTimeInMillis()); return date; |
Map | getDateDiscrepancy(String startDate, String endDate) get Date Discrepancy try { Map<String, Long> result = new HashMap<String, Long>(); Date start = dateFormat.parse(startDate); Date end = dateFormat.parse(endDate); long allsecond = (end.getTime() - start.getTime()) / 1000; long day = allsecond / (24 * 3600); long hour = allsecond % (24 * 3600) / 3600; long minute = allsecond % 3600 / 60; ... |
Date | getDateEnd(Date date) get Date End String dateStr = parseDate2(date, "yyyy-MM-dd"); dateStr = dateStr + " 23:59:59"; return parseDateTime(dateStr); |
Date | getDateForStr(String str) get Date For Str java.sql.Date sqlDate = java.sql.Date.valueOf(str);
return sqlDate;
|
Date | getDateFromISODateString(String isoDate) get Date From ISO Date String String year = getCurrentYear();
return getDateFromRTGSDateString(year + isoDate);
|