Java Timestamp Format format(Date time, String pattern)

Here you can find the source of format(Date time, String pattern)

Description

format

License

Open Source License

Declaration

public static String format(Date time, String pattern) 

Method Source Code


//package com.java2s;
import java.sql.Timestamp;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String format(Timestamp time, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(new Date(time.getTime()));
    }/*from  w ww .j  a v a 2 s.  c  o m*/

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

Related

  1. decodeFileTimestamp(File file, Pattern filenamePattern, DateFormat dateFormat)
  2. format(BigDecimal data)
  3. format(Date aTs_Datetime)
  4. format(Date date)
  5. format(Date date, String format)
  6. format(Date timestamp)
  7. format(Date timestamp, String format)
  8. Format(DateFormat format, Timestamp time)
  9. format(final Date date)