Actually you have to own the share BEFORE the ex dividend date. If you buy ON the ex dividend date you will not be entitled to the dividend.