Java Utililty Methods Timestamp

List of utility methods to do Timestamp

Description

The list of methods to do Timestamp are organized into topic(s).

Method

Timestamptimestamp(Long param)
Converts Long value to appropriate SQL timestamp parameter.
return param != null ? new Timestamp(param) : null;
longtimestampInMs()
timestamp In Ms
return getTimestamp().getTime();
TimestamptimestampIntToTimestamp(long timestampInt)
Converts timestamp to Timestamp-object
return timestampIntToTimestamp(String.valueOf(timestampInt));
booleantimestampIsEquals(Timestamp timestamp1, Timestamp timestamp2)
timestamp Is Equals
return (timestamp1.compareTo(timestamp2) == 0);
StringTimeStampMonthDayYear(Timestamp timestamp)
Time Stamp Month Day Year
if (timestamp == null) {
    return null;
} else {
    return monthDayYearformatter.format((java.util.Date) timestamp);
TimestampTimestampNow()
return the current system time as an SQL Timestamp.
java.util.Date now = new java.util.Date();
return new Timestamp(now.getTime());
java.sql.TimestamptimestampNow()
convienence routine to return current UTC time in Sql timestamp
Calendar now = GregorianCalendar.getInstance(utcTZ);
java.sql.Timestamp sqlNow = new java.sql.Timestamp(now.getTimeInMillis());
return sqlNow;
TimestamptimestampOf(final ZonedDateTime time)
Gets Timestamp for ZonedDateTime.
return timestampOf(time.toInstant());
longtimestampPlusDay(java.sql.Timestamp ts, int iDayPlus)
timestamp Plus Day
if (ts == null) {
    return -1;
java.util.Calendar calendar = java.util.Calendar.getInstance();
calendar.setTimeInMillis(ts.getTime());
int iDay = calendar.get(calendar.DAY_OF_MONTH);
calendar.set(calendar.DAY_OF_MONTH, iDay + iDayPlus);
java.sql.Timestamp tsNew = new java.sql.Timestamp((calendar.getTime()).getTime());
...
StringtimestampPlusDay2DDMMYYYY(java.sql.Timestamp ts, int iDayPlus)
return string dd/mm/yyyy from a Timestamp + a addtional day
if (ts == null) {
    return "";
java.util.Calendar calendar = java.util.Calendar.getInstance();
calendar.setTime(new java.util.Date(ts.getTime()));
int iDay = calendar.get(calendar.DAY_OF_MONTH);
calendar.set(calendar.DAY_OF_MONTH, iDay + iDayPlus);
java.sql.Timestamp tsNew = new java.sql.Timestamp((calendar.getTime()).getTime());
...