How long do I have to hold a stock to get the dividend?

To collect a stock’s dividend you must own the stock at least 1 (one) trading day before the ex-dividend date or the shares should be on the books on the record date.