Ecclesiastes 8:5

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

Ecclesiastes 8:5 in Other Translations

KJV
5 Whoso keepeth the commandment shall feel no evil thing: and a wise man's heart discerneth both time and judgment.
ESV
5 Whoever keeps a command will know no evil thing, and the wise heart will know the proper time and the just way.
NLT
5 Those who obey him will not be punished. Those who are wise will find a time and a way to do what is right,
MSG
5 Carrying out orders won't hurt you a bit; the wise person obeys promptly and accurately.
CSB
5 The one who keeps a command will not experience anything harmful, and a wise heart knows the right time and procedure.

Ecclesiastes 8:5 In-Context

3 Do not be in a hurry to leave the king’s presence. Do not stand up for a bad cause, for he will do whatever he pleases.
4 Since a king’s word is supreme, who can say to him, “What are you doing?”
5 Whoever obeys his command will come to no harm, and the wise heart will know the proper time and procedure.
6 For there is a proper time and procedure for every matter, though a person may be weighed down by misery.
7 Since no one knows the future, who can tell someone else what is to come?
Scripture quoted by permission.  Quotations designated (NIV) are from THE HOLY BIBLE: NEW INTERNATIONAL VERSION®.  NIV®.  Copyright © 1973, 1978, 1984, 2011 by Biblica.  All rights reserved worldwide.