Yes, if you buy the stock before the 'ex-dividend date' and hold it until after this date, then you will be eligible to receive the dividend. In other words, you are eligible to receive a dividend as long as you buy the stock before the ex-dividend date.