Corporate finance - ex-dividend date

If a stock is sold by A on the ex-dividend date to B, who would be the owner on the holder-of-record date two days later? Since the stock was sold on the ex-dividend date, A should receive the scheduled dividend but should B be the owner?

yes

T + 3 settlement. Day | Event 1 2 Ex dvd (buyer of stock won’t get dvd / seller will retain dvd) 3 4 Record date (Xaction has not been settled. seller still thought to be owner). 5 Settlement date (Buyer deemed to be the actual owner) 6

Could you explain please, What the Holder-of-Record date is in practice? What dose happen in that date?