List of utility methods to do Timestamp Field
java.sql.Timestamp | getSqlTimestampFromMicrosSinceEpoch(long timestamp) get Sql Timestamp From Micros Since Epoch java.sql.Timestamp result; if (timestamp >= 0) { result = new java.sql.Timestamp(timestamp / 1000); result.setNanos(((int) (timestamp % 1000000)) * 1000); } else { result = new java.sql.Timestamp((timestamp / 1000000 - 1) * 1000); int remaining = (int) (timestamp % 1000000); result.setNanos((remaining + 1000000) * 1000); ... |
Timestamp | getSqlTimestampFromShortDate(String date) get Sql Timestamp From Short Date Date _date = getShortDate(date); int _year = Integer.parseInt(getYear(_date)); int _month = Integer.parseInt(getMonth(_date)) - 1; int _day = Integer.parseInt(getDay(_date)); Calendar _cal = Calendar.getInstance(); Timestamp _value = new Timestamp(_cal.getTimeInMillis()); try { _cal.set(_year, _month, _day); ... |
String | getStamp(Timestamp timestamp) get Stamp String stamp = timestamp.toString(); stamp = stamp.replaceAll("-", ""); stamp = stamp.replaceAll(":", ""); stamp = stamp.replaceAll("\\.", ""); stamp = stamp.replaceAll(" ", ""); return stamp; |
Timestamp | getStringToTimestamp(String str) get String To Timestamp Timestamp ts = Timestamp.valueOf(str);
return ts;
|
Timestamp | getstrTimestamp(String datetime) getstr Timestamp java.util.Date bb = new java.util.Date(datetime); if (bb != null) { return new Timestamp(bb.getTime()); } else { return null; |
java.sql.Timestamp | getSysDateTimestamp() get Sys Date Timestamp return new java.sql.Timestamp(System.currentTimeMillis()); |
Timestamp | getSystemTimestamp() Returns the current timestamp. return new Timestamp(System.currentTimeMillis()); |
Timestamp | getSystemTimestamp() get System Timestamp return new Timestamp(getSystemTime()); |
Timestamp | getWeekEnd(Timestamp stamp, TimeZone timeZone, Locale locale) get Week End Timestamp weekStart = getWeekStart(stamp, timeZone, locale); Calendar tempCal = toCalendar(weekStart, timeZone, locale); tempCal.add(Calendar.DAY_OF_MONTH, 6); return getDayEnd(new Timestamp(tempCal.getTimeInMillis()), timeZone, locale); |
Timestamp | getWeekEnd(Timestamp stamp, TimeZone timeZone, Locale locale) get Week End Calendar tempCal = toCalendar(stamp, timeZone, locale);
tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.get(Calendar.DAY_OF_MONTH), 0,
0, 0);
tempCal.add(Calendar.WEEK_OF_MONTH, 1);
tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
tempCal.add(Calendar.SECOND, -1);
Timestamp retStamp = new Timestamp(tempCal.getTimeInMillis());
retStamp.setNanos(999999999);
...
|