public static String toDateString(java.util.Date date,String format){
  if (date == null)   return "";
  SimpleDateFormat dateFormat=null;
  if (format != null) {
    dateFormat=new SimpleDateFormat(format);
  }
 else {
    dateFormat=new SimpleDateFormat();
  }
  Calendar calendar=Calendar.getInstance();
  calendar.setTime(date);
  return dateFormat.format(date);
}

public static String toDateString ( java . util . Date date , String format ) { if ( date == null ) return "" ; SimpleDateFormat dateFormat = null ; if ( format != null ) { dateFormat = new SimpleDateFormat ( format ) ; } else { dateFormat = new SimpleDateFormat ( ) ; } Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( date ) ; return dateFormat . format ( date ) ; }
makes a date string in the given from a date
