Java Timestamp Format friendlyTimestamp(Date date)

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

Description

friendly Timestamp

License

Apache License

Declaration

public static String friendlyTimestamp(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

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

    public static String friendlyTimestamp(Date date) {
        return format(date, friendlyTimestampFormat());
    }/* ww w . jav  a 2 s.c o m*/

    /**
     * Returns a string the represents the passed-in date parsed
     * according to the passed-in format.  Returns an empty string
     * if the date or the format is null.
     **/
    public static String format(Date aDate, SimpleDateFormat aFormat) {
        if (aDate == null || aFormat == null) {
            return "";
        }
        synchronized (aFormat) {
            return aFormat.format(aDate);
        }
    }

    public static SimpleDateFormat friendlyTimestampFormat() {
        return new SimpleDateFormat(formatFriendlyTimestamp);
    }
}

Related

  1. formatTimestampWithSlashes( java.sql.Timestamp tsZeitpunkt)
  2. formatTimeToString(long timestamp)
  3. formatToLong(String format)
  4. formatToString(long timestamp, String datePattern)
  5. formatValue(Object obj, boolean isboolean)
  6. friendlyTimestampFormat()
  7. friendlyTimestampFormat()
  8. getCalendar(String timeStamp, final String dateFormat)
  9. getEpochTime(String dateTimeStamp, SimpleDateFormat dateFormat)