List of utility methods to do SQL Time Create
long | getTimeLong(ResultSet resultSet) get Time Long try { String time = resultSet.getString("time"); return formatter.parse(time).getTime(); } catch (Exception e) { try { Time time = resultSet.getTime("time"); return time.getTime(); } catch (Exception e2) { ... |
int | getTimeNumberFromSqlTime(Time time) get Time Number From Sql Time Calendar calendar = Calendar.getInstance(); calendar.setTime(time); final int hour = calendar.get(Calendar.HOUR); final int minute = calendar.get(Calendar.MINUTE); final int second = calendar.get(Calendar.SECOND); final int milli = calendar.get(Calendar.MILLISECOND); return hour * 60 * 60 * 1000 + minute * 60 * 1000 + second * 1000 + milli; |
Timestamp | getTimesByStr(String dataStr) get Times By Str Date d = getDate(dataStr);
String newTime = getString2(d);
return Timestamp.valueOf(newTime);
|
String | getTimeStr(Time time) get Time Str return FORMAT_HMS.format(time);
|
TimeZone | getTimeZone(String id) Get timezone from Id. TimeZone tz = TimeZone.getTimeZone(id); if (tz.getID().equals("GMT") && !id.equals("GMT")) { throw new SQLException("invalid timezone id '" + id + "'"); return tz; |
String | getTimeZone(String timezone, String time, DateFormat format) get Time Zone try { time = time.trim(); if (time.endsWith(":00")) { time = time.substring(0, time.length() - 3) + "00"; Date date = parseDateStringToDate(format, time); Calendar ca = Calendar.getInstance(); ca.clear(); ... |
String | getTodayAndTime() get Today And Time return new Timestamp(System.currentTimeMillis()).toString(); |
Timestamp | getTomorrowOrderTime() get Tomorrow Order Time LocalTime midnight = LocalTime.of(11, 00); LocalDate today = LocalDate.now(ZoneId.systemDefault()); LocalDateTime todayMidnight = LocalDateTime.of(today, midnight); LocalDateTime tomorrowMidnight = todayMidnight.plusDays(1); return new Timestamp(Date.from(tomorrowMidnight.atZone(ZoneId.systemDefault()).toInstant()).getTime()); |
Timestamp | getUserToServerDateTime(TimeZone timeZone, int dateFormat, int timeFormat, String date, Locale locale) Gets the userToServerDateTime attribute of the DateUtils class try { DateFormat localeFormatter = DateFormat.getDateInstance(dateFormat, locale); if (timeZone != null) { localeFormatter.setTimeZone(timeZone); localeFormatter.setLenient(false); return new Timestamp(localeFormatter.parse(date).getTime()); } catch (Exception e) { ... |
long | getWaitTimeout(Connection con) get Wait Timeout Statement stmt = null; ResultSet rs = null; try { stmt = con.createStatement(); rs = stmt.executeQuery("SHOW VARIABLES LIKE 'wait_timeout'"); if (rs.next()) { return Math.max(1000, rs.getInt(2) * 1000 - 1000); } else { ... |