List of utility methods to do SQL Date Create
Date | createDate(int day, int month, int year) create Date Calendar cDate = Calendar.getInstance(); cDate.set(Calendar.DATE, day); cDate.set(Calendar.MONTH, month); cDate.set(Calendar.YEAR, year); return new Date(cDate.getTimeInMillis()); |
DateFormat | createDateFormater(int dataType) create DateFormate depend on dataType. SimpleDateFormat ret; switch (dataType) { case Types.TIME: ret = new SimpleDateFormat("HH:mm:ss"); break; case Types.TIMESTAMP: ret = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); break; ... |
String | createFutureDate(java.sql.Date lmpDate, int offSet) create Future Date GregorianCalendar eddCal = new GregorianCalendar(); String DATE_FORMAT = "yyyy-MM-dd"; java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT); sdf.setTimeZone(TimeZone.getDefault()); eddCal.setTime(java.sql.Date.valueOf(lmpDate.toString())); eddCal.add(Calendar.DATE, offSet); String newDate = sdf.format(eddCal.getTime()); return newDate; ... |
String | createRecGetStatementsUpdate(String tip, String imeFirstCap) create Rec Get Statements Update StringBuilder sb = new StringBuilder(); if (tip.toLowerCase().contains("timestamp")) { sb.append("rec.get").append(imeFirstCap).append("() == null ? null : new java.sql.Timestamp(rec.get") .append(imeFirstCap).append("().getTime())"); } else if (tip.contains("Date")) { sb.append("rec.get").append(imeFirstCap).append("() == null ? null : new java.sql.Date(rec.get") .append(imeFirstCap).append("().getTime())"); } else if (tip.contains("Integer") || tip.contains("Long") || tip.contains("Float") ... |
java.sql.Date | createSqlDate(String dateStr) create Sql Date Date date = createDate(dateStr); if (date != null) { return new java.sql.Date(date.getTime()); return null; |
Statement | createStreamingStatement(Connection conn, boolean update) Returns a statement which tries its best to stream data. int concurrency = update ? ResultSet.CONCUR_UPDATABLE : ResultSet.CONCUR_READ_ONLY; DatabaseMetaData metadata = conn.getMetaData(); String driver = metadata.getDriverName(); if (driver == null) { driver = ""; if (POSTGRESQL_DRIVER_REGEX.matcher(driver).matches()) { logger_.info("Fixing PostgreSQL driver to stream results"); ... |
PreparedStatement | createUpdateStatement(Connection conn, String databaseName, String[] fieldsToUpdate, String[] selectionFields) create Update Statement String updateString = createUpdateString(databaseName, fieldsToUpdate, selectionFields);
return conn.prepareStatement(updateString);
|
String | currentDate() gets current time's string format like "yyyy-MM-dd" return getDateFormat(now());
|
Date | currentDate() current Date return new Timestamp(System.currentTimeMillis()); |
Date | currentDate() current Date calendar.setTimeInMillis(currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return new Date(calendar.getTimeInMillis()); |