The Bible Knowledge Commentary says this this took place in 539 B.C., and Daniel had been in captivity for sixty-six years. Daniel had observed from the scroll of Jeremiah the prophet that Judah’s captivity of seventy years was almost finished. This is what caused him “to seek the Lord by prayer and supplications with fasting, sack cloth and ashes.” He first acknowledged Israel’s sinful past, which had caused their captivity. In verse 11, “Indeed all Israel has transgressed your law… so the curse has been poured out on us….” In verse 19 Daniel prays, “O Lord, hear! O Lord, forgive! O Lord, listen and take action! For your own sake, O my God, do not delay, because Your city and Your people are called by Your Name.”
The prophecy of Jeremiah can be found in Jeremiah 25:11 where it says, “Judah will serve the king of Babylon seventy years.” The fact that this captivity would soon end gave Daniel hope that there could be a return to the Land, which God had given them.