Java Timestamp Create getTimestamp(Date date, String timestampPattern)

Here you can find the source of getTimestamp(Date date, String timestampPattern)

Description

get Timestamp

License

Apache License

Declaration

public static String getTimestamp(Date date, String timestampPattern) 

Method Source Code


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

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

public class Main {
    public static String getTimestamp(Date date, String timestampPattern) {
        if (date != null && timestampPattern != null) {
            SimpleDateFormat formatter = new SimpleDateFormat(timestampPattern);
            return formatter.format(date);
        }//from   w w  w .  ja  v  a2  s  .c  o m
        return date != null ? date.toString() : null;
    }
}

Related

  1. getTimeStamp(Date date)
  2. getTimeStamp(Date date)
  3. getTimeStamp(Date date)
  4. getTimeStamp(Date date)
  5. getTimestamp(Date date)
  6. getTimestamp(Date time)
  7. getTimestamp(final File file)
  8. getTimestamp(final LocalDate date)
  9. getTimestamp(final Map map, final Object key)