List of utility methods to do SQL Date Create
Date | convertDateFromSQLDate(java.sql.Date sqlDate) convert Date From SQL Date if (null == sqlDate) { return null; return new Date(sqlDate.getTime()); |
java.util.Date | convertDateFromSqlToUtil(java.sql.Date sqlDate) convert Date From Sql To Util java.util.Date utilDate = null; if (sqlDate != null) { utilDate = new java.util.Date(); long longTime = sqlDate.getTime(); utilDate.setTime(longTime); return utilDate; |
Date | convertDateFromString(String inputDateString) convert Date From String DateFormat sf = new SimpleDateFormat(DEFAULT_DATE_FORMAT); return new Date(sf.parse(inputDateString).getTime()); |
java.sql.Date | convertDateFromUtilToSql(java.util.Date utilDate) convert Date From Util To Sql java.sql.Date sqlDate = null;
if (utilDate != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(utilDate);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
...
|
Date | convertDateIfNecessary(Date date) convert Date If Necessary if (getPlaceholderDate().equals(date)) { return null; return date; |
String | convertDateToString(java.sql.Date argDate) This method is used to convert date to the specified String format String strDate = ""; if (argDate != null) { SimpleDateFormat dtFormat = new SimpleDateFormat("MM/dd/yyyy"); strDate = dtFormat.format(argDate); return strDate; |
String | convertFormat(java.sql.Date dt, String formatter) conver date format return convertFormat((java.util.Date) dt, formatter);
|
String | convertFormat(String dateData) convert Format return convertFormat(dateData, "yyyy/MM/dd"); |
java.sql.Date | convertiFecha(Date utilFecha) convierte un atributo tipo java.util.Date a un atributo tipo java.sql.Date long fecha = utilFecha.getTime(); java.sql.Date sqlFecha = new java.sql.Date(fecha); return sqlFecha; |
String | convertirSQLDate2String(java.sql.Date sqlDate) convertir SQL Date String long ms = sqlDate.getTime(); java.util.Date utilDate = new java.util.Date(ms); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); return sdf.format(utilDate); |