code: public static String getDate(Date date, Format format) {
  
          DateTimeFormat df;
          switch (format) {
              case FULL:
                  df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_FULL);
                  break;
              case LONG:
                  df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_LONG);
                  break;
              case MEDIUM:
                  df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM);
                  break;
              case SHORT:
                  df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT);
                  break;
              default:
                  // can never happen, just to prevent stupid warning
                  return "";
          }
          return df.format(date);
      }
docs: Returns a formated date String from a Date value,
  the formatting based on the provided options.<p>
  
  @param date the Date object to format as String
  @param format the format to use
  
  @return the formatted date