List of utility methods to do SQL Date Create
Date | convertToDate(Object o) Converts Object to Date. if (o == null) return null; if (o instanceof Date) { return (Date) o; if (o instanceof Timestamp) { return new Date(new java.sql.Date(((Timestamp) o).getTime()).getTime()); if (o instanceof java.sql.Date) { return new Date(((java.sql.Date) o).getTime()); return dateformat.parse(o.toString()); |
java.sql.Date | convertToMySqlDate(Date date) convert To My Sql Date DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String strDate = dateFormat.format(date); System.out.println(strDate); java.sql.Date sqlDate; try { sqlDate = new java.sql.Date(dateFormat.parse(strDate).getTime()); System.out.println(strDate); return sqlDate; ... |
java.sql.Date | convertToSDate(java.util.Date uDate)convertToSDateChuyen ngay kieu java.util.Date thanh java.sql.Dateif (uDate == null) { return null; } else { java.sql.Date sDate = new java.sql.Date(uDate.getTime()); return sDate; |
java.sql.Date | convertToSqlDate(Calendar calendar) convert To Sql Date return new java.sql.Date(calendar.getTimeInMillis()); |
Date | convertToSqlDate(java.util.Date argUtilDate) convert To Sql Date java.sql.Date sqlDate = null; if (isNull(argUtilDate)) { return null; } else { sqlDate = new java.sql.Date(argUtilDate.getTime()); return sqlDate; |
java.sql.Date | convertToSQLDate(java.util.Date date) convert To SQL Date if (date != null) { String formated = DATEFORMAT.format(date); return java.sql.Date.valueOf(formated); return null; |
java.sql.Date | ConvertToSqlDate(java.util.Date date) Convert To Sql Date Long times = date.getTime(); java.sql.Date date1 = new java.sql.Date(times); return date1; |
java.sql.Date | convertToSqlDate(java.util.Date utilDate) convert To Sql Date return new java.sql.Date(utilDate.getTime()); |
java.sql.Date | convertToSqlDate(String str) convert To Sql Date SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd"); java.sql.Date sqlDate = null; try { java.util.Date date = bartDateFormat.parse(str); sqlDate = new java.sql.Date(date.getTime()); } catch (Exception ex) { System.out.println(ex.getMessage()); return sqlDate; |
java.util.Date | convertToUDate(String dateInString)convertToUDateChuyen String dinh dang "dd/MM/yyyy" thanh ngay kieu java.util.Dateif (dateInString == null) { return null; } else { SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); java.util.Date uDate = null; try { uDate = dateFormat.parse(dateInString); } catch (ParseException e) { ... |