Apple's (AAPL 0.51%) incredible success story has led many investors to lament that they didn't buy shares of the tech giant when it was the underdog at the time of its IPO in 1980. When you ask people what they would do if they could go back in time, some say they wish they could go back and tell themselves to buy Apple stock so they could be rich. If you enter, "how rich would you be if you" into the Google search bar, the first thing to pop up is, "how rich would you be if you invested in apple." 

People are fascinated by this tech giant and the affluence associated with it. Looking at a chart of Apple's stock price history (shown below), it's easy to see why some people say that. The stock has climbed over 30,000% since its IPO. 

AAPL Chart

AAPL data by YCharts.

Let's say that you had invested $506 in Apple back in 1980. At its IPO price of $22, you would have 23 shares. After Apple's four stock splits, you would have 1,288 shares of Apple. Today, that $506 investment would have yielded $206,080.00, which is 1,288 shares multiplied by Apple's current $160 per-share price.

When you look at the numbers, it's easy to see why investors regret not putting more faith in the 25-year-old Jobs back in 1980. 

However, just because you missed the first 37 years of Apple's stock gains doesn't mean you have to miss the next 37 years of expected gains. Apple's stock has continually paid off for its investors. 

Let's say you were late to the game and didn't scoop up Apple shares until the day it released the first iPhone on June 29, 2007. If you had purchased 23 shares at its closing price of $17.43 on that day, you would have spent just $400.89. When you take into account Apple's 2014 7-for-1 stock split, that $400.89 investment would be worth $25,760 today. 

With a cash pile of over $261.5 billion, Apple isn't going anywhere. Apple CEO Tim Cook has been criticized for not being as innovative as his predecessor Jobs. However, Cook is leading the company at a time when it's investing a lot of brainpower in a number of up-and-coming industries that could be huge growth drivers in the future now that the smartphone market is maturing. 

Apple CEO Tim Cook

Apple CEO Tim Cook has been criticized for not being as innovative as Steve Jobs. Image source: Apple.

For example, Apple is investing $1 billion in original content that it can offer to its Apple Music subscribers, who pay $9.99 per month. A boost in Apple Music subscribers would help the company hit its goal of $50 billion in services revenue by 2020.

In addition, the company is working on technology that can be integrated into cars to make them drive themselves. This is a worthwhile project considering the self-driving car market is expected to hit $42 billion in 2025, according to the Boston Consulting Group.

If nothing else will convince you, just look to billionaire investor Warren Buffett. His company, Berkshire Hathaway, started buying shares of Apple in mid-2016 and ended the year with about 59 million shares, which it doubled to 133 million shares in January. This is a big deal because Buffett has famously avoided tech stocks because he claims he doesn't buy into things he doesn't understand. "If there's lots of technology, we won't understand it," he said.

When Buffett was asked during an interview on CNBC in February about why he was suddenly an Apple believer, he gave a simple reply: "Because I like it." Buffett said he thinks Apple will be the first company to reach a $1 trillion valuation. Right now, Apple is valued at about $830 billion. "Apple strikes me as having quite a sticky product, and an enormously useful product to people that use it," he said.

In life, hindsight is 20/20. But the most important thing is to learn from your mistakes. If you didn't buy Apple stock in 1980 or in 2007, don't be shortsighted: Buy it today.