Plain and simple: X-Divident was Thurday 12/20 - If you owned the stock at closing on Wednesday 12/19... you get the divident which will appear in your account on 12/28... even if you sold the stock 12/20... if you bought the stock on 12/20... you get ZIP.
The ex-dividend date is two business days prior to the record date. To be a stockholder on the record date an investor must purchase the stock before the ex-dividend date. The latest date he can buy the stock to be a stockholder on record and be entitled to the dividend would be one day prior to the ex-dividend date (this includes extended hours (pre-market and after-hours) of that day) to allow for the three stock trading day settlement of the stock purchase. If the investor purchases the stock the day before the ex-dividend date the investor would be a stockholder on the record date and would be entitled to receive the dividend payment.
An investor who wishes to be entitled to the dividend does not have to wait until after the record date to sell the stock; however, the investor must hold the stock until the ex-dividend date. If the investor were to sell the stock on the ex-dividend date or afterwards, the investor would still be entitled to the dividend payment. In this example, assuming that the investor purchased the stock one day before the ex-dividend date, the investor would be a stockholder on the record date. If the investor sells the stock on the ex-dividend date, the buyer of the stock would be a stockholder one day after the record date given the three stock business trading day settlement. The person that bought the stock would not be entitled to receive the dividend.