Java Timestamp Format timestampToString(Long timestamp, String formatStr)

Here you can find the source of timestampToString(Long timestamp, String formatStr)

Description

timestamp To String

License

Open Source License

Declaration

public static String timestampToString(Long timestamp, String formatStr) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    public static String timestampToString(Long timestamp, String formatStr) {
        if (timestamp == null) {
            return null;
        }/*from   w  w w.  j  a v a2 s  .c om*/
        SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
        try {
            return sdf.format(timestamp);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. timestampFormat(Date date)
  2. timestampFormat(final Date date)
  3. timeStampFormat(Timestamp t)
  4. timestampToFormattedDate(Long timestamp)
  5. timestampToString(final Date ts, final String format, final String tzId)
  6. timeToString(long timestamp, SimpleDateFormat format)
  7. toDateFromTimestamp(String timestamp, String format)
  8. toHumanTime(long timestamp, String format)
  9. toReadableTime(Long timestamp, String format)