List of utility methods to do Timestamp Field
long | getRandomTimeBetweenTwoDates(Timestamp beginDate, Map Method should generate random number that represents a time between two dates. long beginTime, endTime; Calendar cal = Calendar.getInstance(); if (context.get("maxDate") != null) { endTime = ((Timestamp) context.get("maxDate")).getTime(); } else { endTime = cal.getTimeInMillis(); if (beginDate != null) { ... |
Timestamp | getRandTimestamp(Random r) get Rand Timestamp return getRandTimestamp(r, MIN_YEAR, MAX_YEAR);
|
Calendar | getRealCalendar(Timestamp time) get Real Calendar Calendar c = Calendar.getInstance(); c.setTimeInMillis(time.getTime()); if (c.get(Calendar.DAY_OF_WEEK) == 6 && c.get(Calendar.HOUR_OF_DAY) >= 19) { c.setTimeInMillis(c.getTimeInMillis() + 86400000 * 3); clearTime(c); return c; if (c.get(Calendar.DAY_OF_WEEK) == 7) { ... |
Timestamp | getResultRowValueAsTimestamp(String valueName, Map get Result Row Value As Timestamp return (Timestamp) resultRow.get(valueName);
|
long | getSafeLong(final Timestamp d, final long i) get Safe Long return d == null ? i : d.getTime();
|
int | getSeconds(Timestamp timeStamp) get Seconds return timeStamp == null ? 0 : (int) (timeStamp.getTime() / 1000); |
String | getServerToUserDateString(TimeZone timeZone, int dateFormat, java.sql.Timestamp date) Gets the serverToUserDateString attribute of the DateUtils class SimpleDateFormat formatter = null; try { formatter = (SimpleDateFormat) SimpleDateFormat.getDateInstance(dateFormat); formatter.applyPattern("M/d/yyyy"); formatter.setTimeZone(timeZone); } catch (Exception e) { System.err.println("EXCEPTION: DateUtils -> Timestamp " + date); return formatter.format((java.util.Date) date); |
Timestamp | getSqlTimeStamp() get Sql Time Stamp java.sql.Date date = new java.sql.Date(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(date.getTime()); return timestamp; |
java.sql.Timestamp | getSqlTimeStamp(java.util.Date date) Get java.sql.Timestamp from java.util.Date Calendar cal = Calendar.getInstance(); cal.setTime(date); return new java.sql.Timestamp(cal.getTimeInMillis()); |
Timestamp | getSQLTimeStampForDate(Date date) get SQL Time Stamp For Date if (date == null) return null; return new Timestamp(date.getTime()); |