You have until the close today, the day before Ex Dividend date to buy and still get the dividend. Yes you can sell tomorrow if you want to.