String result = null;
if (date!=null) {
if (date instanceof TIMESTAMP){
try {
TIMESTAMP ts = (TIMESTAMP)date;
Date dateTemp = new Date(ts.timestampValue().getTime());
result = dfyyyyMMddHHMMSS.format(dateTemp);
} catch (SQLException e) {
e.printStackTrace();
}