Java Utililty Methods Timestamp Field

List of utility methods to do Timestamp Field

Description

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

Method

StringgetFormattedDateTimeColumn(final Timestamp ts, final SimpleDateFormat formatDate)
get Formatted Date Time Column
String dt = "";
if (ts != null) {
    dt = formatDate.format(new Date(ts.getTime()));
    if (dt == null) {
        dt = "";
return dt;
...
StringgetFormattedTimeStamp(long millisSince1970)
get Formatted Time Stamp
Timestamp stamp = new Timestamp(millisSince1970);
SimpleDateFormat formatDate = new SimpleDateFormat(MARTUS_SIGNATURE_FILE_DATE_FORMAT);
String dateStamp = formatDate.format(stamp);
return dateStamp;
DategetFromTimestamp(Timestamp timestamp)
Get a date from a timestamp
if (timestamp == null) {
    return null;
return new Date(timestamp.getTime());
StringgetHms(Timestamp timestamp)
get Hms
SimpleDateFormat bartDateFormat = new SimpleDateFormat("HH:mm:ss");
String hms = bartDateFormat.format(timestamp);
return hms;
StringgetHoraHHMM(Timestamp dataHoraRef)
get Hora HHMM
StringBuilder sb = new StringBuilder();
GregorianCalendar d = new GregorianCalendar();
d.setTime(dataHoraRef);
String aux = "" + d.get(GregorianCalendar.HOUR_OF_DAY);
if (aux.length() < 2)
    aux = "0" + aux;
sb.append(aux);
aux = "" + d.get(GregorianCalendar.MINUTE);
...
IntegergetInterval(ArrayList times)
get Interval
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
System.out.printf("Printing %s\n" + times.get(0).toString());
System.out.printf("Printing %s\n" + times.get(times.size() - 1).toString());
Integer length = times.size();
return length;
intgetIntervalInDays(Timestamp from, Timestamp thru)
get Interval In Days
return thru != null ? (int) (thru.getTime() - from.getTime()) / (24 * 60 * 60 * 1000) : 0;
StringgetISOTimeStampStringFormat(Timestamp ts)
get ISO Time Stamp String Format
String result = "";
try {
    String temp = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(ts);
    result = temp.substring(0, 4);
    result = result + "-";
    result = result + temp.substring(5, 7);
    result = result + "-";
    result = result + temp.substring(8, 10);
...
TimestampgetKDCTStoTimestamp(short[] in)
Helper für KDC100 Konvertiert KDC100 Timestamp auf java.sql.Timestamp
Calendar c = getKDCTStoCal(in);
Timestamp ts = new java.sql.Timestamp(c.getTimeInMillis());
return ts;
LocalDateTimegetLocalDateTime(final long timestamp)
Gets the LocalDateTime for a timestamp in UTC

return getLocalDateTime(getInstant(timestamp));