In the third year of the reign of Jehoiakim king of Judah, Nebuchadnezzar king of Babylon came to Jerusalem and besieged it. And the Lord gave Jehoiakim king of Judah into his hand, with some of the vessels of the house of God. And he brought them to the land of Shinar, to the house of his god, and placed the vessels in the treasury of his god. Then the king commanded Ashpenaz, his chief eunuch, to bring some of the people of Israel, both of the royal family and of the nobility, youths without blemish, of good appearance and skillful in all wisdom, endowed with knowledge, understanding learning, and competent to stand in the king's palace, and to teach them the literature and language of the Chaldeans. The king assigned them a daily portion of the food that the king ate, and of the wine that he drank. They were to be educated for three years, and at the end of that time they were to stand before the king. Among these were Daniel, Hananiah, Mishael, and Azariah of the tribe of Judah.The beginning of Daniel's time in Babylon is dated to Jehoiakim's 3rd year at which time Nebuchanezzar was called king. Daniel and his 3 friends were to be educated for 3 years. At the end of the 3 years they were brought before Nebuchadnezzar and found competent. In Nebuchanezzar's 2nd year he has a dream and orders the wise men to be killed as they are unable to tell him the dream. Daniel tells him the dream and interprets it then he is promoted to ruler over the province of Babylon.
As for these four youths, God gave them learning and skill in all literature and wisdom, and Daniel had understanding in all visions and dreams. At the end of the time, when the king had commanded that they should be brought in, the chief of the eunuchs brought them in before Nebuchadnezzar. And the king spoke with them, and among all of them none was found like Daniel, Hananiah, Mishael, and Azariah. Therefore they stood before the king. And in every matter of wisdom and understanding about which the king inquired of them, he found them ten times better than all the magicians and enchanters that were in all his kingdom. And Daniel was there until the first year of King Cyrus.
In the second year of the reign of Nebuchadnezzar, Nebuchadnezzar had dreams; his spirit was troubled, and his sleep left him. (Daniel 1:1-6; 1:17-2:1. Emphases are the chronological data in this passage.)
So how can Daniel be educated in 3 years and subsequently appear before Nebuchadnezzar after only 2 years?
It seems likely that the events surrounding the dream occur after Daniel and his friends complete their training. While having Daniel appear before the king during his training may solve the chronological problem, it raises other problems, such as how Daniel would be promoted yet remain in training.
Here are some possible solutions.
Accuracy of number
The number could be miscopied. It is likely that many minor numerical copy errors crept into the Hebrew text before the numbers came to be written out in full. Alphabetical glyphs doubled as numerical glyphs in Hebrew and several letters were similar in form. The resolution would be to say that this event was not in Nebuchanezzar's second year but some time later.
The year Nebuchadnezzar brought Daniel to Babylon may have been his accession year. Nebuchadnezzar came to the throne during the year, the remainder of the year is his accession year if the Chaldeans used accession reckoning. The New Year marks the beginning of his first regnal year. By Nebuchadnezzar's second year Daniel had trained for parts of 3 years: accession, regnal 1, regnal 2. Hebrew reckoning includes parts of a year so this would be considered 3 years.
The first chronological datum above references King Jehoiakim's 3rd year, not Nebuchadnezzar's reign. Nebuchadnezzar is called a king but this event may have occurred before he became king thus anachronistic. He subsequently became king and the author refers to him as such, much as we could refer to, say, when King David was born.
Nebuchadnezzar may have been a coregent. If Nebuchadnezzar was made a coregent with the previous king then his own rulership would be dated from when he became sole king, usually on the death of the previous king. Jeremiah tells us that the 4th year of Jehoiakim was the 1st year of Nebuchadnezzar (Jer 25:1). It is possible that Daniel's mention of Jehoiakim's 3rd year was the previous year, which may have been Nebuchadnezzar's accession year (as per the above option).
It is important to bring all the chronological information to bear on biblical chronological problems, as well as the cultural, textual and linguistic issues before concluding errors. Not all solutions are realistic, but neither are all problems real.