Here you can find the source of toSqlDate(Date date)
toSqlDate (date):
convert Date to SQL Date
Parameter | Description |
---|---|
date | Date |
public static java.sql.Date toSqlDate(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { /**/* w ww. jav a2 s . co m*/ * <code>toSqlDate (date):</code> convert Date to SQL Date * @param date Date * @return SQL Date */ public static java.sql.Date toSqlDate(Date date) { if (date == null) return null; java.sql.Date sqlDate = new java.sql.Date(date.getTime()); return sqlDate; } /** * <code>toSqlDate (cal):</code> convert Calendar to SQL Date * @param cal Calendar * @return SQL Date */ public static java.sql.Date toSqlDate(Calendar cal) { if (cal == null) return null; java.sql.Date sqlDate = new java.sql.Date(cal.getTime().getTime()); return sqlDate; } /** * <code>getTime (timezone):</code> get the time now * @param zone time zone * @return Calendar instance */ public static Calendar getTime(TimeZone zone) { return Calendar.getInstance(zone); } }