List of utility methods to do SQL Date Create
java.sql.Date | convertJavaDate2SqlDate(java.util.Date date) convert Java Date Sql Date return new java.sql.Date(date.getTime()); |
Date | converToDate(String yyyy, String mm, String dd) conver To Date Date date = java.sql.Date.valueOf(yyyy + "-" + mm + "-" + dd); return date; |
Date | convertSqlDate(java.util.Date date) convert Sql Date Date result = null; result = new Date(date.getTime()); return result; |
Calendar | convertSqlDate2Calendar(java.sql.Date date) Convert Date to Calendar. Calendar cal = null; if (date != null) { cal = GregorianCalendar.getInstance(); cal.setTime(date); return cal; |
Date | convertSqlDateToJavaDate(java.sql.Date sqlDate) convert Sql Date To Java Date Date javaDate = null; if (sqlDate != null) { javaDate = new Date(sqlDate.getTime()); return javaDate; |
java.util.Date | convertSQLDateToUtilDate(java.sql.Date date) convert SQL Date To Util Date java.util.Date convertedDate = null; date.setYear(date.getYear() - 1900); date.setMonth(date.getMonth() - 1); convertedDate = new java.util.Date(date.getTime()); return convertedDate; |
java.sql.Date | convertSqlUtil(java.util.Date d) convertSqlUtil Realiza la conversion un java.util.Date a java.sql.Date java.sql.Date res = new java.sql.Date(new java.util.Date().getTime()); if (d != null) { res = new java.sql.Date(d.getTime()); return res; |
Timestamp | convertStringToSql(final String dateStr) convert String To Sql return new Timestamp(format.parse(dateStr).getTime()); |
Calendar | convertToCalendar(Date date) convert To Calendar Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(date.getTime());
return calendar;
|
java.sql.Date | convertToDatabaseDate(Date date) convert To Database Date if (date == null) return null; return new java.sql.Date(date.getTime()); |