What It Means
The ex-dividend date is the first day a stock trades without the value of its upcoming dividend attached. If you buy the stock on or after this date, you won't receive that particular dividend — only shareholders who held it before the ex-date get paid.
How It Works
A company sets a record date to determine who qualifies for a dividend; the ex-dividend date, set by the exchange based on the settlement cycle, falls before it so that only trades settled in time actually count. On the ex-dividend date itself, a stock's opening price typically drops by roughly the dividend amount — the market adjusting for the fact that the cash is about to leave the company. This isn't the stock "losing value" in any real sense; it's the price reflecting a payout that's now guaranteed to someone else.
Example
If a stock closes at ₹500 and announces a ₹5-per-share dividend with an ex-date of the following Monday, the stock typically opens Monday around ₹495, all else equal. A trader who bought on Friday qualifies for the ₹5 dividend; a trader who buys Monday doesn't, but pays roughly ₹5 less for the stock.
Warning
Buying a stock right before its ex-dividend date purely to "collect the dividend" usually doesn't create free money — the price adjustment on the ex-date typically offsets the payout, and short-term capital gains tax can apply if you sell quickly after.