List of utility methods to do SQL Date From
Date | toDate(Object obj) to Date if (obj instanceof java.util.Date) { return (Date) obj; if (obj instanceof java.sql.Date) { java.sql.Date sqlDate = (java.sql.Date) obj; return new Date(sqlDate.getTime()); if (obj instanceof Calendar) { ... |
java.sql.Date | toDate(Object value) Convert an Object to a Date. if (value == null) { return null; if (value instanceof java.sql.Date) { return (java.sql.Date) value; if (value instanceof String) { if ("".equals((String) value)) { ... |
Date | toDate(String dateString) to Date return parseDate(dateString);
|
Date | toDate(String s) Convert String to Date int len = s.length(); if (len >= 10) { int c4 = s.charAt(4); int c7 = s.charAt(7); if (c4 == '-' && c7 == '-') { return Date.valueOf(s.substring(0, 10)); return null; |
Date | toDateFromString(String str) to Date From String DateFormat format = new SimpleDateFormat(DATE_FORMAT_DEFAULT); Date date = null; try { date = format.parse(str); } catch (ParseException e) { e.printStackTrace(); return date; ... |
DateMidnight | toDateMidnight(java.util.Date d) to Date Midnight DateMidnight dm = (d == null ? null : new DateMidnight(d)); return dm; |
String | toDateStr(java.util.Date d) to Date Str if (d == null) { return null; } else { return (new SimpleDateFormat(Simple_Date_Format)).format(d); |
java.sql.Date | toSqlDate(Calendar calendar) to Sql Date if (calendar == null) { return null; return new java.sql.Date(calendar.getTimeInMillis()); |
java.sql.Date | toSqlDate(Date date) null safe convert from util date to sql date if (date == null) { return null; return new java.sql.Date(date.getTime()); |
java.sql.Date | toSqlDate(Date date) to Sql Date if (date != null) { return new java.sql.Date(date.getTime()); } else { return null; |