List of utility methods to do SQL Date Get
String | getDate(String pattern) get Date SimpleDateFormat sf = new SimpleDateFormat(pattern); return sf.format(new Timestamp(System.currentTimeMillis())); |
java.util.Date | getDate(String strDate) Converts a String date in a "jj/mm/aaaa" format in a java.util.Date type date ParsePosition pos = new ParsePosition(0); java.util.Date date = _formatter.parse(strDate, pos); return date; |
String | getDate(String theDateStr, int days) get Date Date theDate = java.sql.Date.valueOf(theDateStr); Calendar c = new GregorianCalendar(); c.setTime(theDate); c.add(GregorianCalendar.DATE, days); java.sql.Date d = new java.sql.Date(c.getTime().getTime()); return d.toString(); |
Date | getDate(String value) Helper to create a date given a string of the form yyyy-mm-dd. return value != null ? getDatetime(value + " 0:0:0") : null; |
java.sql.Date | getDate(String year, String month, String day) get Date java.sql.Date result = null; try { String str = year + "-" + month + "-" + day; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); java.util.Date date1 = dateFormat.parse(str); result = new java.sql.Date(date1.getTime()); } catch (Exception e) { System.out.println("Exception " + e); ... |
Date | getDate(Timestamp establishdate) Gets the date. if (establishdate == null) return new Date(); else { return new Date(establishdate.getTime()); |
Date | getDate(Timestamp timestamp) get Date if (timestamp != null) { return new Date(timestamp.getTime()); } else { return null; |
String | getDate(Timestamp timestamp) Gets time in dd/mm/yy format from java.sql.Timestamp. GregorianCalendar cal = new GregorianCalendar(); cal.setTime(timestamp); return getDate(cal); |
String | getDate(Timestamp ts) get Date if (ts == null) return ""; DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String tsStr = sdf.format(ts); return tsStr; |
Date | getDateAddMonth(java.sql.Date date, int months) get Date Add Month if (date == null) { return null; cal.setTime(new java.util.Date(date.getTime())); int month = cal.get(java.util.Calendar.MONTH); cal.set(java.util.Calendar.MONTH, month + months); return new java.sql.Date(cal.getTime().getTime()); |