Java Timestamp Create getTimestamp(java.util.Date utilDate)

Here you can find the source of getTimestamp(java.util.Date utilDate)

Description

converts a java.util.Date to java.sql.Timestamp

License

BSD License

Parameter

Parameter Description
utilDate java.util.Date

Return

sqlTimestamp java.sql.Timestamp

Declaration

public static java.sql.Timestamp getTimestamp(java.util.Date utilDate) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright Duke Comprehensive Cancer Center and SemanticBits
 * /* ww w  .j  a  v a 2  s. c  o m*/
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/c3pr/LICENSE.txt for details.
 ******************************************************************************/

import java.sql.Time;

import java.util.Date;

public class Main {
    /**
     * converts a java.util.Date to java.sql.Timestamp
     * 
     * @param utilDate
     *                java.util.Date
     * @return sqlTimestamp java.sql.Timestamp
     */
    public static java.sql.Timestamp getTimestamp(java.util.Date utilDate) {
        return new java.sql.Timestamp(utilDate.getTime());
    }

    public static Time getTime(Date date) {
        return new Time(date.getTime());
    }
}

Related

  1. getTimestamp(final File file)
  2. getTimestamp(final LocalDate date)
  3. getTimestamp(final Map map, final Object key)
  4. getTimestamp(int offset)
  5. getTimestamp(int year, int month, int day, int hour, int min, int second)
  6. getTimestamp(long time)
  7. getTimestamp(Object o)
  8. getTimestamp(Object value)
  9. getTimestamp(Object value, int columnType)