docs: @SuppressWarnings("deprecation")
    public Date getInternalDate(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
        throws SQLException {
      if (lastValueWasNull()) {
        return null;
      }
  
      switch (columnInfo.getColumnType()) {
        case DATE:
          int[] datePart = new int[]{0,0,0};
          int partIdx = 0;
          for (int begin = pos; begin < pos + length; begin++) {
            byte b = buf[begin];
            if (b == '-') {
              partIdx++;
              continue;
            }
            if (b < '0' || b > '9') {
              throw new SQLException(
                  "cannot parse data in date string '" + new String(buf, pos, length, StandardCharsets.UTF_8) + "'");
            }
            datePart[partIdx] = datePart[partIdx] * 10 + b - 48;
          }
  
          if (datePart[0] == 0 && datePart[1] == 0 && datePart[2] == 0) {
            lastValueNull |= BIT_LAST_ZERO_DATE;
            return null;
          }
  
          return new Date(
              datePart[0] - 1900,
              datePart[1] - 1,
              datePart[2]);
  
        case TIMESTAMP:
        case DATETIME:
          Timestamp timestamp = getInternalTimestamp(columnInfo, cal, timeZone);
          if (timestamp == null) {
            return null;
          }
          return new Date(timestamp.getTime());
  
        case TIME:
          throw new SQLException("Cannot read DATE using a Types.TIME field");
  
        case YEAR:
          int year = 0;
          for (int begin = pos; begin < pos + length; begin++) {
            year = year * 10 + buf[begin] - 48;
          }
          if (length == 2 && columnInfo.getLength() == 2) {
            if (year <= 69) {
              year += 2000;
            } else {
              year += 1900;
            }
          }
          return new Date(year - 1900, 0, 1);
  
        default:
  
          try {
            DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            sdf.setTimeZone(timeZone);
            java.util.Date utilDate = sdf.parse(new String(buf, pos, length, StandardCharsets.UTF_8));
            return new Date(utilDate.getTime());
  
          } catch (ParseException e) {
            throw ExceptionMapper
                .getSqlException("Could not get object as Date : " + e.getMessage(), "S1009", e);
          }
      }
    }