Java Timestamp Create toTimestamp(Date date)

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

Description

to Timestamp

License

Open Source License

Declaration

public static Timestamp toTimestamp(Date date) 

Method Source Code

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

import java.sql.Timestamp;
import java.util.*;

public class Main {
    public static Timestamp toTimestamp(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);//from w  w w.j  a  v  a  2 s.  c  om
        calendar.set(Calendar.MILLISECOND, 0);
        return new Timestamp(calendar.getTimeInMillis());
    }
}

Related

  1. toSQLTimestamp(DateTime dt)
  2. toSqlTimestamp(java.util.Date date)
  3. toSQLTimestamp(Object object, Object oDefault)
  4. toSQLTimestamp(String time)
  5. toTimestamp(BigDecimal value)
  6. toTimestamp(Date date)
  7. toTimestamp(Date date)
  8. toTimeStamp(Date date, String time)
  9. toTimestamp(DateTime dt)