* Apollo 11: The LM, "Eagle", was on the lunar surface for 21 hours, 36 minutes.
* Other Apollo Missions: The LMs used in subsequent Apollo missions were on the lunar surface for varying lengths of time, depending on the mission objectives. The average time was around 21 hours.
However, it's important to differentiate between the LM itself and the lunar modules' ascent stages. While the descent stage remained on the Moon, the ascent stage carrying the astronauts lifted off and rejoined the command module in lunar orbit.
So, while the descent stage of the LM remained on the Moon permanently, the LM as a whole was only on the surface for a relatively short time.