Java Date to Timestamp getDisplayableTimeStamp(Date timeStamp)

Here you can find the source of getDisplayableTimeStamp(Date timeStamp)

Description

Used for all of the timestamps in caIntegrator2.

License

BSD License

Parameter

Parameter Description
timeStamp to format to a displayable string.

Return

displayable timestamp string.

Declaration

public static String getDisplayableTimeStamp(Date timeStamp) 

Method Source Code

//package com.java2s;
/**/*from w w  w.  j a v  a 2  s  .  c  o m*/
 * Copyright 5AM Solutions Inc, ESAC, ScenPro & SAIC
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/caintegrator/LICENSE.txt for details.
 */

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;

public class Main {
    /**
     * String for timestamp if it is null.
     */
    public static final String TIMESTAMP_UNAVAILABLE_STRING = "Unavailable";
    private static final String TIMESTAMP_FORMAT = "MM/dd/yyyy HH:mm:ss";

    /**
     * Used for all of the timestamps in caIntegrator2.
     * @param timeStamp to format to a displayable string.
     * @return displayable timestamp string.
     */
    public static String getDisplayableTimeStamp(Date timeStamp) {
        return timeStamp == null ? TIMESTAMP_UNAVAILABLE_STRING
                : new SimpleDateFormat(TIMESTAMP_FORMAT, Locale.US).format(timeStamp);
    }
}

Related

  1. dateToTimestamp(java.util.Date date)
  2. escapeAsTimestamp(Date date)
  3. getAsTimestampOrEmptyString(Date date)
  4. getAuditTimestamp(Date date)
  5. getDetailedTimeStamp(Date date)
  6. getDisplayTimeStamp(Date date)
  7. getJnlpTimestamp(Date date)
  8. getTimestamp(Date date)
  9. getTimestamp(Date date)