Java Timestamp Format format(Date date)

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

Description

format

License

Apache License

Declaration

public static String format(Date date) 

Method Source Code


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

import java.sql.Timestamp;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String PATTERN_CLASSICAL = "yyyy-MM-dd HH:mm:ss";

    public static String format(Date date) {
        return format(date, PATTERN_CLASSICAL);
    }//w  w w.  java 2s  . c  o m

    public static String format(Timestamp date) {
        return format(date, PATTERN_CLASSICAL);
    }

    public static String format(Date date, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(date);
    }
}

Related

  1. compareTimstampStr(String timestamp1, String timestamp2, String format)
  2. decodeFileTimestamp(File file, Pattern filenamePattern, DateFormat dateFormat)
  3. format(BigDecimal data)
  4. format(Date aTs_Datetime)
  5. format(Date date, String format)
  6. format(Date time, String pattern)
  7. format(Date timestamp)
  8. format(Date timestamp, String format)