Java Timestamp Format Format(DateFormat format, Timestamp time)

Here you can find the source of Format(DateFormat format, Timestamp time)

Description

Format

License

Open Source License

Declaration

public static String Format(DateFormat format, Timestamp time) 

Method Source Code


//package com.java2s;

import java.sql.Timestamp;
import java.text.DateFormat;

import java.util.Date;

public class Main {

    public static String Format(DateFormat format, Timestamp time) {
        synchronized (format) {
            String t = "";
            try {
                t = format.format(time);
            } catch (Exception e) {
                return t;
            }/* www .  ja v a2s.  c o m*/
            return t;
        }
    }

    public static String Format(DateFormat format, Date time) {
        synchronized (format) {
            String t = "";
            try {
                t = format.format(time).replace("24:", "00:");
            } catch (Exception e) {
                return t;
            }
            return t;
        }
    }

    public static String Format(DateFormat format, long time) {
        synchronized (format) {
            String t = "";
            try {
                t = format.format(time);
            } catch (Exception e) {
                return t;
            }
            return t;
        }
    }
}

Related

  1. format(Date date)
  2. format(Date date, String format)
  3. format(Date time, String pattern)
  4. format(Date timestamp)
  5. format(Date timestamp, String format)
  6. format(final Date date)
  7. format(final long unixTimeStamp)
  8. format(long timestamp)
  9. format(long timeStamp)