Java SQL Date Convert dateToSqlDate(Date date)

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

Description

Date to SqlDate

License

Open Source License

Parameter

Parameter Description
date Date

Return

Date

Declaration

public static java.sql.Date dateToSqlDate(Date date) 

Method Source Code

//package com.java2s;
/**/*w  ww  .  j  a v  a 2s  .  c o m*/
 * Copyright 2010 ZTEsoft Inc. All Rights Reserved.
 *
 * This software is the proprietary information of ZTEsoft Inc.
 * Use is subject to license terms.
 * 
 * $Tracker List
 * 
 * $TaskId: $ $Date: 9:24:36 AM (May 9, 2008) $comments: create 
 * $TaskId: $ $Date: 3:56:36 PM (SEP 13, 2010) $comments: upgrade jvm to jvm1.5 
 *  
 *  
 */

import java.util.Date;

public class Main {
    /**
     * Date to SqlDate
     * 
     * @param date
     *            Date
     * @return Date
     */
    public static java.sql.Date dateToSqlDate(Date date) {
        if (date == null) {
            return null;
        } else if (date instanceof java.sql.Date) {
            return (java.sql.Date) date;
        } else {
            return new java.sql.Date(date.getTime());
        }
    }
}

Related

  1. dateToBytes(Date d)
  2. dateToCalendar(Date input)
  3. dateToInternal(java.sql.Date date)
  4. dateToLong(Date date)
  5. dateToSql(Date dat)
  6. dateToSqlDate(Date date)
  7. DateToSQLDate(Date pDate)
  8. dateToSQLDate(java.util.Date d)
  9. dateToStamp(String date)