It depends on what format does your DB supports or used to store date value. E.g. for DB/2, the default date format is MM/DD/YYYY so the way to format your data would need a use of SimpleDateFormat() and use a Calendar() object to set the date and time to convert to the proper format.
Look at the following Calendar to DB/2 date format function of mine:
Code:
public final String SQLCalFieldFormat(Object value) {
if ((value != null)
&& ((value.getClass().equals(GregorianCalendar.class)
|| (value.getClass().equals(Calendar.class))))) {
Calendar nv = (Calendar) value;
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
return "'" + formatter.format(nv.getTime()) + "'";
} else {
return "NULL";
}
}
Hope this helps!
Neo Gigs
Thanks
Neo Gigs