Under t-plus-one settlement the ex-date and the record-date are normally the same day. To receive the dividend you must buy before the ex-date, which in practice means owning the stock at the close the previous session.
The exchange reduces the prior close by the dividend amount for opening reference purposes, and open limit-order and stop-order instructions may be adjusted or cancelled by the exchange, which surprises traders who left resting orders overnight.
Example: a stock closes at $84.00 and goes ex a $1.10 dividend. The adjusted reference close is $82.90. If it opens at $83.60 the stock is actually up 70 cents on the day, not down 40 cents.
Related: ex-dividend-price-adjustment, record-date, dividend-capture, t-plus-one