List of utility methods to do SQL Date Convert
String | to_char(Date date, String format) tchar SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(date).trim(); |
String | to_char(Date date, String format) tchar SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(date).trim(); |
BigDecimal | toBigDecimal(@Nullable final Date value) to Big Decimal return (value == null ? null : BigDecimal.valueOf(value.getTime()));
|
Calendar | toCalender(final Date aDate) to Calender Calendar c = Calendar.getInstance();
c.setTimeInMillis(aDate.getTime());
return c;
|
java.sql.Date | todaySqlDate() Returns the current date as java.sql.Date return new java.sql.Date(Calendar.getInstance().getTimeInMillis()); |
java.sql.Timestamp | toDBDate(String str) to DB Date SimpleDateFormat simpleDateFormat = new SimpleDateFormat(yyyyMMddHHmmssSS); try { Date date = simpleDateFormat.parse(str); Calendar cal = Calendar.getInstance(); cal.setTime(date); return new java.sql.Timestamp(cal.getTimeInMillis()); } catch (ParseException e) { e.printStackTrace(); ... |
String | toEnglishDate(String stringDate) given format of (yyyy-mm-dd hh:mm:ss.000000000 or yyyy-mm-dd) , and return dd/mm/yyyy String year = ""; String month = ""; String dateOfMonth = ""; stringDate = stringDate.toString().substring(0, 10); int checkyear = -1; if (stringDate.trim().equals("")) { return "''"; } else { ... |
String | toGMT(final Date ts) to GMT return timestampToString(ts, STANDARD_DATETIMEFORMAT, TZ_UTC);
|
int | toInt(java.util.Date v) Converts the Java type used for UDF parameters of SQL DATE type ( java.sql.Date ) to internal representation (int). return toInt(v, LOCAL_TZ);
|
int | toIntDate(Object object, int iDefault) to Int Date Date date = toDate(object, null); if (date == null) return iDefault; return longDateToInt(date.getTime()); |