Java String to Timestamp getTimeStamp(String style, Date date)

Here you can find the source of getTimeStamp(String style, Date date)

Description

get Time Stamp

License

Apache License

Declaration

public static String getTimeStamp(String style, Date date) 

Method Source Code


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

import java.text.DateFormat;

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

public class Main {

    public static String getTimeStamp() {
        DateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        return format.format(new Date());
    }//w ww  .j a  va 2  s .c o  m

    public static String getTimeStamp(String style, Date date) {
        DateFormat format = new SimpleDateFormat(style);
        return format.format(date);
    }
}

Related

  1. getTimeStamp(String date)
  2. getTimeStamp(String dateTime)
  3. getTimestamp(String dateValue, String pattern, TimeZone timezone)
  4. getTimestamp(String pattern)
  5. getTimeStamp(String pattern, String strDate)
  6. getTimestamp(String timeStampStr, String logRundateIdStr)
  7. getTimestamp(String timezone, String dateTime, String pattern)
  8. getTimestampFromDateString(String date)
  9. getTimeStampInSecond(String timeStr)