To be eligible to receive the dividend, you must buy the shares before the Ex-date of the dividend. Here's how you check the ex-date for a dividend of any stock:

Step 1: Visit

Step 2: Look for the stock in the search column.

Step 3:  Let's say you look for ITC Limited. Scroll down and click on 'Corporate Information' and select 'Corporate Action' on the left-hand side menu. You will be able to see the ex-date for the dividend of the stock.