To be eligible for dividends, you need to be holding the stock in your on the record date of the dividend issue. You should have bought the stock at least one day before the ex-date so that the stocks are delivered to your demat account by the record date.