List of utility methods to do Timestamp Field
LocalTime | getLocalTime(final Timestamp timestamp) get Local Time return timestamp != null ? timestamp.toLocalDateTime().toLocalTime() : null;
|
Timestamp | getMessageTimestamp(int id) get Message Timestamp Timestamp t = null;
return t;
|
Timestamp | getMillTimestamp() get Mill Timestamp return new Timestamp(System.currentTimeMillis()); |
Timestamp | getMonthEnd(Timestamp stamp, TimeZone timeZone, Locale locale) get Month End Calendar tempCal = toCalendar(stamp, timeZone, locale); tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.getActualMaximum(Calendar.DAY_OF_MONTH), 0, 0, 0); return getDayEnd(new Timestamp(tempCal.getTimeInMillis()), timeZone, locale); |
Timestamp | getMonthLastDay(Timestamp day) Get last date in month if (day == null) day = new Timestamp(System.currentTimeMillis()); GregorianCalendar cal = new GregorianCalendar(); cal.setTimeInMillis(day.getTime()); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); ... |
java.sql.Timestamp | getMonthStart(java.sql.Timestamp stamp) Return the date for the first day of the month return getMonthStart(stamp, 0, 0);
|
Timestamp | getMonthStartTimestamp(Date date) get Month Start Timestamp Date start = getMonthStartDate(date); return new Timestamp(start.getTime()); |
int | getNanos(Timestamp timestamp) get Nanos return timestamp.getNanos();
|
String | getNanoString(Timestamp timestamp, boolean full, char nanoSep) Gets nano string suffix of a timestamp. String zeros = "000000000"; int nanos = timestamp.getNanos(); String nanosString = Integer.toString(nanos); nanosString = zeros.substring(0, (9 - nanosString.length())) + nanosString; char[] nanosChar = new char[nanosString.length()]; nanosString.getChars(0, nanosString.length(), nanosChar, 0); int truncIndex = 8; while (truncIndex > 0 && nanosChar[truncIndex] == '0') { ... |
int | getNbHours(Timestamp dateA, Timestamp dateB) get Nb Hours return (int) ((dateB.getTime() - dateA.getTime()) / 3600000); |