Java Date to Timestamp getTimestamp(Date date)

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

Description

get Timestamp

License

Open Source License

Declaration

public static Timestamp getTimestamp(Date date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Timestamp getTimestamp(Date date) {

        return Timestamp.valueOf(dateStr(date));

    }/*from ww w . j ava2  s .  c om*/

    public static String dateStr(Date date) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String newStr = dateFormat.format(date);
        return newStr;
    }
}

Related

  1. getDisplayableTimeStamp(Date timeStamp)
  2. getDisplayTimeStamp(Date date)
  3. getJnlpTimestamp(Date date)
  4. getTimestamp(Date date)
  5. getTimestamp(Date date)
  6. getTimestamp(Date date)
  7. getTimestamp(Date date)
  8. getTimestamp(Date date)
  9. getTimestamp(Date date)