List of utility methods to do SQL Time
int | getIntervalDays(Date time1, Date time2) get Interval Days if (time1 == null || time2 == null) return 0; return getIntervalDays(time1.getTime(), time2.getTime()); |
String | getJoinedSysDateTime() get Joined Sys Date Time String str = getSysDateTime();
str = str.substring(0, 4) + str.substring(5, 7) + str.substring(8, 10) + str.substring(11, 13)
+ str.substring(14, 16) + str.substring(17, 19);
return str;
|
Timestamp | getLastTimeOfDay(Calendar calendar) get Last Time Of Day calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); return new Timestamp(calendar.getTimeInMillis()); |
Timestamp | getMaxModifyTime(String path) get Max Modify Time List<String> filelist = getAllFileName(path); Timestamp time = null; for (String s : filelist) { File f = new File(s); if (time == null) { time = new Timestamp(f.lastModified()); } else { if (time.getTime() < new Timestamp(f.lastModified()).getTime()) { ... |
int | getMaxPollTime(final Connection jdbcConnection, final String tableName) get Max Poll Time int maxRow = 0; Statement stmt = null; ResultSet rs = null; try { stmt = jdbcConnection.createStatement(); String sql = MessageFormat.format("SELECT max(polltime) as maxpoll FROM {0}", tableName); rs = stmt.executeQuery(sql); if (rs.next()) { ... |
java.util.Date | getServerTime() get Server Time GregorianCalendar date = new GregorianCalendar(); return date.getTime(); |
TimeZone | getServerTimezone(Properties dbSettings) Returns the Server timezone. if (serverTimeZone == null) { String url = dbSettings.getProperty("hibernate.connection.url"); String username = dbSettings.getProperty("hibernate.connection.username"); String password = dbSettings.getProperty("hibernate.connection.password"); Connection conn = DriverManager.getConnection(url, username, password); ResultSet rs = conn.createStatement() .executeQuery("select timestampdiff(HOUR,utc_timestamp(), current_timestamp());"); String timediff = ""; ... |
String | getSGWDateTime(long dateTime) get SGW Date Time dateTime = dateTime * 1000; long sd = (dateTime - 28800000); Date dat = new Date(sd); return formatTime(dat); |
java.sql.Timestamp | getSQLDate(long datetime) get SQL Date return new Timestamp(datetime); |
Timestamp | getSQLDateTime() Method getSQLDateTime. Calendar caldate = Calendar.getInstance(); Timestamp t = new Timestamp(caldate.getTimeInMillis()); t.setTime(caldate.getTimeInMillis()); return t; |