code: public String getDateString(Date dateTarget, int iDateFormat)
      {
          stringBuffer.setLength(0);
          FieldPosition fieldPosition = new FieldPosition(iDateFormat);
          String string = null;
          string = dateFormat.format(dateTarget, stringBuffer, fieldPosition).toString();
          int iBegin = fieldPosition.getBeginIndex();
          int iEnd = fieldPosition.getEndIndex();
          string = string.substring(iBegin, iEnd);
          return string;
      }
docs: Convert this data to a string (using the supplied format).
  @param dateTarget The date to convert to a string.
  @param iDateFormat The format for the date.
  @return The date as a string.