5 Whoever obeys his command will come to no harm, and the wise heart will know the proper time and procedure.

Read Ecclesiastes 8:5 Using Other Translations

Whoso keepeth the commandment shall feel no evil thing: and a wise man's heart discerneth both time and judgment.
Whoever keeps a command will know no evil thing, and the wise heart will know the proper time and the just way.
Those who obey him will not be punished. Those who are wise will find a time and a way to do what is right,