John Gill's Exposition of the Whole Bible
Ecclesiastes 3:17
I said in mine heart, God shall judge the righteous and the wicked,.... This he considered in his mind, and set it down for a certain truth, and which relieved him under the consideration of the sad perversion of justice; and made him easy under it, and willing to leave things to him that judgeth righteously, and wait his time when everything that was now wrong would be set right: he knew from reason, from tradition, and from the word of God, that there was a judgment to come, a general, righteous, and eternal one; that this judicial process would be carried on by God himself, who is holy, righteous, just, and true, omniscient, and omnipotent; and, being the Judge of all the earth, would do right; when he would vindicate the righteous, and clear them from all calumnies and charges; acquit and justify them, and condemn the wicked, pass a just sentence on them, and execute it;
for [there is] a time there for every purpose, and for every work; or "then", as Noldius; in the day of the great judgment, as the Targum adds; and which continues to paraphrase the words thus,
"for a time is appointed for every business, and for every work which they do in this world they shall be judged there;''
there is a time fixed, a day appointed, for the judgment of the world; though of that day and hour knows no man; yet, it is settled, and will certainly come, Acts 17:31; and when it is come, every purpose, counsel, and thought of men's hearts, will be made manifest, as well as every work, good or bad, open or secret, yea, every idle word, and men will be judged according to these; see 1 Corinthians 4:5