To know a man’s secret, you must spend adequate time with Him.
The longer the time you spend with God the deeper the secret of God you access.
For Moses to know God, He had to spend quality time with God. Exodus 33.
David was not exempted from the same process. Psalms 27:4; 63:1,2; 84.
Friendship is developed by intimacy.
You must be intimately close to know God.
It is not possible to know God from afar. James 4:6.