Stock market trades generally settle a few days after the trade date. This
is the day shares and cash actually change hands. But the settlement date
doesn't matter for purposes of determining when your sale took place. If
your trade date is in the current year and your settlement date is in the
following year, the tax law says you made the sale in the current year (year
of the trade date).