January 07, 2012

util to sql date and util from sql date conversion

util to sql date and util from sql date conversion

Description: This is an example for date parsing in java. Convert java util date to sql date. Java date convertor.

convertToSqlDate
/**
*
* @see example
* @param
* @return sqlDate java.sql.Date
*
Description : This function convert util date for sql Date. util date manipulation is used in user interface and sql date in back end process
* Date :Nov 12, 2009
* Coded by : belazy
*/
@Override
public java.sql.Date convertToSqlDate(Date utilDate) {
java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
return sqlDate;
}
convertToUtilDate
/**
*
* @see
* @param
* @return
* Description :
* Date Dec 5, 2009
* Coded by : belazy
*/
@Override
public Date convertToUtilDate(java.sql.Date sqlDate) {
//java.util.Date utilDate = new java.util.Date(sqlDate.getTime());
java.util.Date utilDate = new java.util.Date(sqlDate.getTime());
return utilDate;
}
Thanks to +aromal chandra for his support...

Facebook comments