Java SQL Date from Util Date getSqlDate(java.util.Date utilDate)

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

Description

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

License

BSD License

Parameter

Parameter Description
utilDate java.util.Date

Return

sqlDate java.sql.Date

Declaration

public static java.sql.Date getSqlDate(java.util.Date utilDate) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright Duke Comprehensive Cancer Center and SemanticBits
 * /*  w  ww  .  j  ava2  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.Date
     * 
     * @param utilDate
     *                java.util.Date
     * @return sqlDate java.sql.Date
     */
    public static java.sql.Date getSqlDate(java.util.Date utilDate) {
        return new java.sql.Date(utilDate.getTime());
    }

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

Related

  1. getSQLDate(final Date oDate)
  2. getSqlDateDefaultFormat(java.sql.Date date)
  3. getSqlDateFromDateNumber(short dateNumber)