Java Date to Timestamp getDisplayTimeStamp(Date date)

Here you can find the source of getDisplayTimeStamp(Date date)

Description

get Display Time Stamp

License

LGPL

Declaration

public static String getDisplayTimeStamp(Date date) 

Method Source Code

//package com.java2s;
/*/*  ww w.j a  v  a2  s  .  c  o m*/
 * JLib - Publicitas Java library v1.2.0.
 *
 * Copyright (c) 2005, 2006, 2007, 2008, 2009 Publicitas SA.
 * Licensed under LGPL (LGPL-LICENSE.txt) license.
 */

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private String format = "yyyy.MM.dd HH:mm:ss";

    public static String getDisplayTimeStamp() {
        Date date = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        String cs = formatter.format(date);
        return cs;
    }

    public static String getDisplayTimeStamp(Date date) {
        if (date != null) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
            String cs = formatter.format(date);
            return cs;
        }
        return "";
    }
}

Related

  1. escapeAsTimestamp(Date date)
  2. getAsTimestampOrEmptyString(Date date)
  3. getAuditTimestamp(Date date)
  4. getDetailedTimeStamp(Date date)
  5. getDisplayableTimeStamp(Date timeStamp)
  6. getJnlpTimestamp(Date date)
  7. getTimestamp(Date date)
  8. getTimestamp(Date date)
  9. getTimestamp(Date date)