The Ex-date and Record date for all corporate actions will be the same as per the current settlement cycle which is T+1 working day. So Ex-Date is the date by which you must own the shares in your demat account to be eligible for the dividend. You can find the details of the ex-date and record date on the NSE/BSE website. Please refer to the below shared example for your reference : 

Example : VEDANTA LIMITED ( VEDL) has announced the dividend of Rs.11 Per Share where the Ex-Date and Record date was 27-Dec-2023. So if you have bought the VEDL share before 27-Dec-2023 then you will be eligible for the dividend.