List of utility methods to do Timestamp
boolean | isDST(Timestamp ts) Whether we are in DST for a particular time in the servers default timezone. return !DateTimeZone.getDefault().isStandardOffset(ts.getTime());
|
boolean | isInPast(Timestamp timeStamp) is In Past return timeStamp.getTime() < System.currentTimeMillis();
|
boolean | isLongDate(Timestamp date) Tells whether Timestamp is in long format: with hours, minutes and seconds fields. return date.toString().indexOf("00:00:00") == -1; |
boolean | isLongTerm(Timestamp oldTime, Timestamp newTime) is Long Term long delta = Math.abs(newTime.getTime() - oldTime.getTime()); int days = (int) (delta / (1000 * 60 * 60 * 24)); if (days >= 365) { return true; return false; |
boolean | isSameDay(Timestamp one, Timestamp two) Is it the same day GregorianCalendar calOne = new GregorianCalendar(); calOne.setTimeInMillis(one.getTime()); GregorianCalendar calTwo = new GregorianCalendar(); calTwo.setTimeInMillis(two.getTime()); if (calOne.get(Calendar.YEAR) == calTwo.get(Calendar.YEAR) && calOne.get(Calendar.MONTH) == calTwo.get(Calendar.MONTH) && calOne.get(Calendar.DAY_OF_MONTH) == calTwo.get(Calendar.DAY_OF_YEAR)) return true; ... |
boolean | isSameMonth(Timestamp t1, Timestamp t2) is Same Month Calendar cal = Calendar.getInstance(); cal.setTime(t1); int year1 = cal.get(Calendar.YEAR); int month1 = cal.get(Calendar.MONTH); System.out.println("year1:" + year1 + "month1:" + month1); cal.setTime(t2); int year2 = cal.get(Calendar.YEAR); int month2 = cal.get(Calendar.MONTH); ... |
boolean | IsTechStatisticWorkTime(Timestamp timestamp) Is Tech Statistic Work Time try { int weekDay = getDayOfWeek(timestamp); if (weekDay >= 1 && weekDay <= 5) { if ((timestamp.getHours() >= 8 && timestamp.getHours() < 22)) { return true; } else { if (((timestamp.getHours() >= 10)) && timestamp.getHours() < 19) { ... |
boolean | isTimeStamp(Class o) is Time Stamp return o.toString().equals("class java.sql.Timestamp"); |
boolean | isTimestamp(String aS_DateTime, String aS_Format) Checks if datetime is aS_DateTime is same as in aS_Format return stringToTimestamp(aS_DateTime, aS_Format, null, null) != null;
|
boolean | isTimestamp(String str) is Timestamp try { @SuppressWarnings("unused") Date d = java.sql.Date.valueOf(str); return true; } catch (Exception e) { return false; |