docs: @SuppressWarnings("deprecation")
    public Date getInternalDate(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
        throws SQLException {
      if (lastValueWasNull()) {
        return null;
      }
      switch (columnInfo.getColumnType()) {
        case TIMESTAMP:
        case DATETIME:
          Timestamp timestamp = getInternalTimestamp(columnInfo, cal, timeZone);
          return (timestamp == null) ? null : new Date(timestamp.getTime());
        case TIME:
          throw new SQLException("Cannot read Date using a Types.TIME field");
        case STRING:
          String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8);
          if ("0000-00-00".equals(rawValue)) {
            lastValueNull |= BIT_LAST_ZERO_DATE;
            return null;
          }
  
          return new Date(
              Integer.parseInt(rawValue.substring(0, 4)) - 1900,
              Integer.parseInt(rawValue.substring(5, 7)) - 1,
              Integer.parseInt(rawValue.substring(8, 10))
          );
        default:
          if (length == 0) {
            lastValueNull |= BIT_LAST_FIELD_NULL;
            return null;
          }
  
          int year = ((buf[pos] & 0xff) | (buf[pos + 1] & 0xff) << 8);
  
          if (length == 2 && columnInfo.getLength() == 2) {
            //YEAR(2) - deprecated
            if (year <= 69) {
              year += 2000;
            } else {
              year += 1900;
            }
          }
  
          int month = 1;
          int day = 1;
  
          if (length >= 4) {
            month = buf[pos + 2];
            day = buf[pos + 3];
          }
  
          Calendar calendar = Calendar.getInstance();
          calendar.clear();
          calendar.set(Calendar.YEAR, year);
          calendar.set(Calendar.MONTH, month - 1);
          calendar.set(Calendar.DAY_OF_MONTH, day);
          calendar.set(Calendar.HOUR_OF_DAY, 0);
          calendar.set(Calendar.MINUTE, 0);
          calendar.set(Calendar.SECOND, 0);
          calendar.set(Calendar.MILLISECOND, 0);
          Date dt = new Date(calendar.getTimeInMillis());
          return dt;
      }
    }