List of utility methods to do SQL Time Create
java.sql.Time | getTime(Object value) Convert an Object to a Time, without an Exception try { return toTime(value); } catch (ParseException pe) { pe.printStackTrace(); return null; |
java.sql.Time | getTime(Object value, int columnType) get Time if (value == null) { return null; switch (columnType) { case java.sql.Types.TIME: { return (java.sql.Time) value; case java.sql.Types.TIMESTAMP: { ... |
Date | getTime(ResultSet resultSet, String columnName) Returns a time value using a given SQL result set and column name. Date value = null; if (resultSet != null && columnName != null) { value = resultSet.getTime(columnName); return value; |
Time | getTime(ResultSet rs, String column) get a Time from ResultSet rs with name 'column' Time i = rs.getTime(column); if (rs.wasNull()) i = new Time(0); return i; |
Timestamp | getTime(String time) get Time Timestamp timestamp = null; try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); java.util.Date parsedDate = dateFormat.parse(time); timestamp = new java.sql.Timestamp(parsedDate.getTime()); } catch (Exception e) { e.printStackTrace(); return timestamp; |
String | getTimeAndDateStamp(String line) get Time And Date Stamp Date unixTimeStamp = new Date(Long.parseLong(line.split(" ")[0])); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd-MM-yy, hh:mm a z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); return sdf.format(unixTimeStamp); |
Timestamp | getTimeBy(int hour) get Time By return getTimeBy(hour, 0, 0, 0);
|
String | getTimeFormat() get Time Format return TIME_FORMAT;
|
Time | getTimeFromCalendar(final Calendar calendar) A utility to return the Time part of a calendar. return (Time.valueOf(toTimeString(calendar)));
|
List | getTimeList(ResultSet resultSet, String columnName) Returns a list of time values using a given SQL result set and column name. List<Date> values = null; if (resultSet != null && columnName != null) { values = new ArrayList<Date>(); while (resultSet.next()) { values.add(getTime(resultSet, columnName)); return values; ... |