If I buy share one day before ex-dividend date then if i sell it on ex divident date, then I will be eligble for dividend or not?
You are eligible for Dividends if you purchase shares before ex-date and sell the shares on ex-date.
Even If I buy it before one day, because I heard that it takes T+2 days for transfer of shares??
Yes, even if you buy it a day before ex-date and sell on ex-date you are eligible for Dividends.
A stock trades as cum dividend (with dividend rights) until ex-date, on ex-date the stock starts trading without dividend (ex-dividend), as you had purchased the stock when it was trading with dividend rights and sell when it went ex-dividend, you are eligible to receive dividends.
In such cases, ie. when you sell shares on ex-date, broker will receive the dividends on your behalf who in turn will credit it to your trading account.
Thanks you so much for the clear explanation.