Here you can find the source of convert(Date date)
Parameter | Description |
---|---|
date | the java.util.Date to convert |
public static java.sql.Date convert(Date date)
//package com.java2s; /*//from w w w . j av a 2 s . c o m * Copyright 2011-2013 StackFrame, LLC * * This is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 * as published by the Free Software Foundation. * * You should have received a copy of the GNU General Public License * along with this file. If not, see <http://www.gnu.org/licenses/>. */ import java.util.Date; public class Main { /** * Given a java.util.Date, return a java.sql.Date. * * @param date the java.util.Date to convert * @return the date in java.sql.Date */ public static java.sql.Date convert(Date date) { if (date instanceof java.sql.Date) { return (java.sql.Date) date; } else { return new java.sql.Date(date.getTime()); } } }