public static String dateToString(final Date date, final String format) {
        if (date == null) {
            return null;
        }
        final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
        return dateFormat.format(date);
    }
public static String dateToString ( final Date date , final String format ) { if ( date == null ) { return null ; } final DateFormat dateFormat = new SimpleDateFormat ( format , Locale . US ) ; return dateFormat . format ( date ) ; }
Date to string.

@param date
the date
@param format
the format
@return the string