Java Utililty Methods Date to Timestamp

List of utility methods to do Date to Timestamp

Description

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

Method

StringescapeAsTimestamp(Date date)
escape As Timestamp
return "{ts '" + tsdf.format(date) + "'}";
StringgetAsTimestampOrEmptyString(Date date)
get As Timestamp Or Empty String
return formatDate(TIME_STAMP_DATE_FORMAT, date, "");
StringgetAuditTimestamp(Date date)
get Audit Timestamp
String value = null;
if (date != null) {
    value = AUDIT_FORMAT.format(date);
return value;
StringgetDetailedTimeStamp(Date date)
Returns a time stamp of the format "yy.MM.dd - HH:mm" for the given date.
SimpleDateFormat formatter = new SimpleDateFormat("yy.MM.dd - HH:mm:ss:SSS");
return formatter.format(date);
StringgetDisplayableTimeStamp(Date timeStamp)
Used for all of the timestamps in caIntegrator2.
return timeStamp == null ? TIMESTAMP_UNAVAILABLE_STRING
        : new SimpleDateFormat(TIMESTAMP_FORMAT, Locale.US).format(timeStamp);
StringgetDisplayTimeStamp(Date date)
get Display Time Stamp
if (date != null) {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    String cs = formatter.format(date);
    return cs;
return "";
StringgetJnlpTimestamp(Date date)
get Jnlp Timestamp
final SimpleDateFormat dateFormat = new SimpleDateFormat(JNLP_TIMESTAMP_DATETIME_FORMAT);
return JNLP_TIMESTAMP_PREFIX + dateFormat.format(date);
TimestampgetTimestamp(Date date)
get Timestamp
return new Timestamp(date.getTime());
TimestampgetTimestamp(Date date)
get Timestamp
return date == null ? currentTimestamp() : new Timestamp(date.getTime());
TimestampgetTimestamp(Date date)
get Timestamp
return Timestamp.valueOf(dateStr(date));