List of utility methods to do SQL Date Convert
Date | dateToBeginOfDay(Date data) date To Begin Of Day if (data != null) { Calendar dtAux = Calendar.getInstance(); dtAux.setTime(data); dtAux.set(Calendar.HOUR_OF_DAY, 0); dtAux.set(Calendar.MINUTE, 0); dtAux.set(Calendar.SECOND, 0); dtAux.set(Calendar.MILLISECOND, 0); return new Date(dtAux.getTimeInMillis()); ... |
byte[] | dateToBytes(Date d) date To Bytes Calendar cal = Calendar.getInstance(); cal.setTime(d); byte[] b = new byte[5]; b[0] = (byte) 0; b[1] = (byte) (cal.get(Calendar.YEAR) & 0xff); b[2] = (byte) (cal.get(Calendar.YEAR) >>> 8); b[3] = (byte) (cal.get(Calendar.MONTH) & 0xff); b[4] = (byte) (cal.get(Calendar.DATE) & 0xff); ... |
Calendar | dateToCalendar(Date input) date To Calendar java.util.Calendar output = Calendar.getInstance();
output.setTime(input);
return output;
|
int | dateToInternal(java.sql.Date date) Converts the Java type used for UDF parameters of SQL DATE type ( java.sql.Date ) to internal representation (int). return dateToInternal(date, UTC_ZONE);
|
long | dateToLong(Date date) date To Long long millis = date.getTime(); if (date instanceof java.sql.Date) return millis; else if (date instanceof Time) return millis; else if (date instanceof Timestamp) return millis; return (millis / 1000) * 1000; ... |
java.sql.Date | dateToSql(Date dat) From java.util.Date to java.sql.Date. java.sql.Date dSql = null; if (dat != null) dSql = new java.sql.Date(dat.getTime()); return dSql; |
java.sql.Date | dateToSqlDate(Date date) Date to SqlDate if (date == null) { return null; } else if (date instanceof java.sql.Date) { return (java.sql.Date) date; } else { return new java.sql.Date(date.getTime()); |
java.sql.Date | dateToSqlDate(Date date) date To Sql Date if (date == null) { return null; return new java.sql.Date(date.getTime()); |
java.sql.Date | DateToSQLDate(Date pDate) Date To SQL Date java.sql.Date dd = new java.sql.Date(pDate.getTime()); return dd; |
Date | dateToSQLDate(java.util.Date d) date To SQL Date return d != null ? new Date(d.getTime()) : null; |