Between February and October 1945, the Dow Jones Industrial Average advanced 21.3%. Must have been a time of prosperity, or a bubble, right?

Nope. Would you believe that this performance occurred during a recession? Since we're still unclear about whether the current economy is out of recession for good, or whether it will dip back downward, it's worth reflecting on what that uncharacteristic market behavior can teach us. Before you buy the hype, take a look at how the stock market has actually performed during and following recessions in the past.

Recessions aren't "bad"
Contrary to popular media opinion, not every single recession is bad for the investor. In the 1945, 1953-1954, and 1980 recessions, stock market returns behaved as if they were in a period of prosperity. As mentioned, during the recession of February to October 1945, the market actually jumped 21.3%.

Investors who are quick to head for the exits simply because there is a recession looming are forgetting one very important fact: The principal goal of an investor is to focus on acquiring strong businesses selling at attractive prices -- regardless of the market environment.

This time around, investors who bought stocks when the recession was first officially announced last December have done handsomely, getting in near the bottom, and catching the entire rally since March. Yet that won't always happen. You might experience a little volatility, or find yourself waiting months for any capital appreciation. But that's the nature of the markets -- sometimes they rise, sometimes they fall, and sometimes they go nowhere.

Market timing is useless
Of course, recessions aren't always good for stocks. From December 2007, when economists say the recession started, to March 2009, stocks fell precipitously. And historically, during recessions, stocks have more often declined than advanced. But the notion that recessions always destroy returns is not the case.

Sure, some companies behind consumer luxuries will tend to see a big squeeze. If the economy is tough, penny-pinching consumers might cut back on perceived luxuries from high-end retailers like Nordstrom (NYSE:JWN) and handbag maker Coach (NYSE:COH), or they may delay replacing old vehicles with new ones, hurting automakers like Ford (NYSE:F). Indeed, that's largely why those stocks fell so sharply before the recent rally.

The economy, though, still needs to function at some level. People will still need to eat, do laundry, brush their teeth, buy medicines, etc. That boded well for dividend-paying consumer-staples powerhouses such as Kimberly-Clark (NYSE:KMB), Johnson & Johnson (NYSE:JNJ), and Colgate-Palmolive (NYSE:CL), all of which have held up reasonably well throughout the financial crisis.

Moreover, consumers have to buy somewhere. That made McDonald's (NYSE:MCD) a good candidate to weather a recession; with consumers paying closer attention to their pocketbooks, the company's reputation as a place for bargains gives it a leg up.

Recessions develop over time. There is no set formula that reveals to us when a recession begins and when it ends. Even though some have said that the recession is over, others think we're still in it and could see things get worse before they get better. Yet as those on the sidelines know all too well now, waiting for the "end" will often lead to waiting until it's too late and missing out on a great buying opportunity. So the key, again, is to buy quality issues for cheap and be patient.

Invest in the company first, not the market cycle.

It's not the end of the world
What's most important about recessions is at some point, they cease and things pick up. You'd never guess that during a recession -- there's too much noise pronouncing doom and gloom.

But the facts speak for themselves. Not only do they end, but investors who exhibit patience are rewarded in the following year. Those who wait it out on the sidelines -- until the headlines provide a cheery consensus -- later come to realize that they've missed a whole lot of the party.

Do you think you're a smart investor? Read why Anand Chokkavelu thinks you might be too smart to get rich.

This article, written by Sham Gad, was originally published on Feb. 6, 2008. It has been updated by Dan Caplinger, who doesn't own shares of the companies mentioned. Coach is a Motley Fool Stock Advisor recommendation. Johnson & Johnson and Kimberly-Clark are Motley Fool Income Investor recommendations. Try any of our Foolish newsletters today, free for 30 days. The Fool has a disclosure policy.