Elham in Iran asks:
“I wanna know if there is any exact formula for distance between planets at the right time !”
Distances between planets vary, as orbits themselves are slightly elliptical.
If you know the orbits of two planets, and the position each planet is in each orbit,
yes, you could calculate the distance between two planets.
Much as I dislike wikipedia, this article may help you learn more: