The surest path toward generating strong returns in the stock market is to hold stocks for many years, if not decades. Time in the market, as the saying goes, is a more powerful strategy than timing the market.

Dividend stocks are ideal long-term investments for several reasons. They tend to be stable businesses that suffer less volatility than high-growth stocks, for one. That stability can help you keep turnover low in your portfolio. Dividend stocks also provide a steady stream of income, buffering your returns through down markets and through cyclical upturns.

With those benefits in mind, let's look at two safe dividend giants that could be a feature in your portfolio well into retirement. Read on for some good reasons to buy shares of McDonald's (MCD -0.91%) and Procter & Gamble (PG -0.78%) with an eye toward holding them for decades.

McDonald's is tasty

Don't let its long dividend track record fool you into thinking that McDonald's is a stodgy value stock. On the contrary, the fast-food giant is putting up stellar growth numbers these days. Comparable-store sales were up 9% in the most recent quarter thanks to high demand for its brand of convenient, tasty food at attractive prices.

Those wins were powered by improvements in McDonald's ordering and dining experiences that are raising customer satisfaction and boosting average spending in a competitive environment. "Our third-quarter results reflect our position of strength as the industry leader," CEO Chris Kempczinski said in a late-October press release.

The stock comes with financial benefits, too, including McDonald's industry-leading profit margin that's sitting well above 40% of sales today. Cash flow is stellar as well, helping fund a 10% increase to the chain's dividend this past quarter. That boost was the company's 47th consecutive annual dividend increase.

Procter & Gamble sells more products

Procter & Gamble has McDonald's -- and most other stocks -- beat with its dividend streak. That's one big benefit of P&G's focus on the consumer-essentials niche, which tends to hold up well even during recessions.

You probably won't dramatically change your consumption of things like paper towels, laundry detergent, and baby care products during downturns, and P&G dominates these categories, in some cases accounting for more than 40% of global sales.

That helps explain how P&G has paid a dividend each year since 1890. It has hiked that annual payout in each of the last 67 years, a period that encompasses many recessions.

It isn't just a defensive stock as its 2.5% dividend yield might suggest. Sales growth was a surprisingly strong 7% last quarter, and management boosted its forecast following that robust result.

P&G does have some challenges to face in the coming quarters. Inflation has slowed, which means it won't get as much of a lift from price increases. Keep an eye on the sales volume metric for signs of success here. That figure declined by 1% last quarter but will need to return to positive territory soon for growth to remain healthy.

In the meantime, income investors can choose to reinvest P&G's quarterly dividend, amplifying their returns over time. Steady reinvestments can help you hold stocks for longer, since they ensure you'll accumulate more shares during stock market downturns. You might even start to look forward to those regular ups and downs, which don't threaten long-term returns.