The mission followed these steps:
1. Launch: The crew launched from Earth.
2. Trans-Lunar Injection (TLI): The spacecraft was propelled towards the Moon.
3. Lunar Orbit Insertion (LOI): Once in lunar orbit, the spacecraft circled the Moon for about 30 hours to prepare for the landing.
4. Lunar Landing: The Lunar Module (LM) separated from the Command Module (CM) and landed on the Moon.
5. Lunar Surface Operations: The crew spent about 21 hours on the lunar surface, including their moonwalk.
6. Lunar Ascent: The LM launched from the lunar surface.
7. Docking: The LM docked with the CM in lunar orbit.
8. Trans-Earth Injection (TEI): The spacecraft was propelled towards Earth.
9. Splashdown: The crew splashed down in the Pacific Ocean.
So, the 30 hours spent in lunar orbit was after the spacecraft had reached the Moon and before the landing.