public String formatDate(Date date, int type)
    {
        String string = null;
        if (type == DBConstants.DATE_TIME_FORMAT)
            string = XmlUtilities.dateTimeFormat.format(date);
        else if (type == DBConstants.DATE_ONLY_FORMAT)
            string = XmlUtilities.dateFormat.format(date);
        else if (type == DBConstants.TIME_ONLY_FORMAT)
            string = XmlUtilities.timeFormat.format(date);
        return string;
    }
public String formatDate ( Date date , int type ) { String string = null ; if ( type == DBConstants . DATE_TIME_FORMAT ) string = XmlUtilities . dateTimeFormat . format ( date ) ; else if ( type == DBConstants . DATE_ONLY_FORMAT ) string = XmlUtilities . dateFormat . format ( date ) ; else if ( type == DBConstants . TIME_ONLY_FORMAT ) string = XmlUtilities . timeFormat . format ( date ) ; return string ; }
FormatDate Method.