Dividend yield is calculated by dividing the dividend per share by the market price per share and multiplying the result by 100
If you buy the stock on or after the Ex-dividend date, then you won’t get the dividend, instead, the previous seller will get the dividend.