“I said in my heart.” An idiomatic way of saying, “I said to myself” (cp. HCSB; NASB; NIV).
“God will judge.” The judgment of God on the Day of Judgment is a theme in Ecclesiastes, concluding in the very last verse in Ecclesiastes, Ecclesiastes 12:14. Furthermore, many verses say that on Judgment Day people will get what they deserve based on how they lived their life (cp. Job. 34:11; Ps. 62:12; Prov. 24:12; Jer. 17:10; 32:19; Ezek. 33:20; Matt. 16:27; Rom. 2:6; 1 Cor. 3:8). See commentary on Psalm 62:12.
“for there is a time of judgment for every purpose and for every deed.” The sentence is saying that God will judge both the righteous and the wicked, and although people are many on the earth, and their purposes and deeds are many, there will be time for everyone to be judged. Indeed, there will be a time of judgment for every purpose and deed, as the verse says (cp. James Bollhagan, Concordia Commentary: Ecclesiastes: “for there will be a time of judgment for every matter and upon every deed there”).
This verse is not saying that every purpose and work has a proper time, that is stated in Ecclesiastes 3:1-8. Ecclesiastes 3:17 is saying that God will judge what people think and do, which is also stated in Ecclesiastes 11:9, and is also the concluding thought in Ecclesiastes: “For God will bring everything we do into judgment, including every hidden thing, whether it is good or whether it is evil” (Ecc. 12:14).