I want to be a stockholder on record for a dividend. So lets assume I bought stock before the ex dividend date. Can I immediately sell the stock after the ex-dividend date to collect the dividend, or do I need to hold for a few weeks to collect the dividend?

Lets say the ex-dividend date is the 15th of the month. I buy stock on the 14th (I think this is soon enough to be a shareholder on record) and then I sell on the 15th. Do I get the dividend in my account when it is distributed?

Don't worry – I have a proprietary way of hedging the stock's post-dividend price adjustment, and it costs less than the actual dividend so all is well.

I just don't know what the shortest time I can hold a position is. I'd like to know the shortest theoretical time possible in order to get the dividend.

Insight appreciated.