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.util.Calendar;
import java.util.Date;

public class Main {
    public static Timestamp getTimestamp(Date date) {
        return new Timestamp(removeMilis(date).getTime());
    }//from   ww  w . ja v a  2  s . c  om

    public static Date removeMilis(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }
}

Related

  1. getTimestamp(Date date)
  2. getTimestamp(Date date)
  3. getTimestamp(Date date)
  4. getTimestamp(Date date)
  5. getTimestamp(Date date)
  6. getTimeStamp(Date date, String time)
  7. removeTimestamp(Date date)
  8. timestamp(Calendar date)
  9. timestamp(Date d)