List of utility methods to do SQL Time Parse
java.util.Date | parseDateTime(String original, int type) parse Date Time String s = original; if (s == null) { return null; try { int timeStart = 0; TimeZone tz = null; if (type == TIME) { ... |
Time | parseTime(String s) parse Time if (s == null) { return null; try { return new Time(simpleTimeFormat.parse(s).getTime()); } catch (ParseException e) { return null; |
long | parseTime(String str) Parse the given string as a time, using the following time pattern: hh:mm:ss[.fffffffff] . String nanos_s; long hour; long minute; long second; long a_nanos = 0; String formatError = "Timestamp format must be hh:mm:ss[.fffffffff]"; String zeros = "000000000"; if (str == null) ... |
Time | parseTime(String timeString) parseTime: Returns a Time SQL object corresponding to the given time string. Date javaDate = null; try { javaDate = new SimpleDateFormat("hh:mm aaa").parse(timeString); } catch (ParseException e) { if (javaDate == null) { try { javaDate = new SimpleDateFormat("hh aaa").parse(timeString); ... |
String | printTime(Time time, String format) Print the time in the format. if (time == null) { return ""; return new SimpleDateFormat(format).format(time); |
java.sql.Timestamp | string2Time(String dateString) string Time DateFormat dateFormat; dateFormat = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss", Locale.ENGLISH); dateFormat.setLenient(false); java.util.Date timeDate = dateFormat.parse(dateString); java.sql.Timestamp dateTime = new java.sql.Timestamp(timeDate.getTime()); return dateTime; |
Time | string2Time(String time, DateFormat timeFormat) string Time if (time == null) return null; return new Time(string2Date(time, timeFormat).getTime()); |
Timestamp | stringToTime(String data, String dateFormat) StringToDate Convert String to Timestamp if (data == null || data.isEmpty()) return null; SimpleDateFormat formatter = new SimpleDateFormat(dateFormat); ParsePosition pos = new ParsePosition(0); java.util.Date date = null; Timestamp timestamp = null; date = formatter.parse(data, pos); timestamp = new Timestamp(date.getTime()); ... |
Time | stringToTime(String schedule) string To Time if (schedule == null || schedule.isEmpty()) return null; String[] parts = schedule.split(SEPARATOR); if (parts.length != 3) return null; int hour = Integer.parseInt(parts[0]); int minute = Integer.parseInt(parts[1]); int second = Integer.parseInt(parts[2]); ... |
Time | stringToTime(String sTime) string To Time SimpleDateFormat stringToTime = new SimpleDateFormat("HH:mm:ss"); Calendar cal = GregorianCalendar.getInstance(); cal.setTimeInMillis(stringToTime.parse(sTime).getTime()); return new Time(cal.getTimeInMillis()); |