The moon and the earth are at almost the same distance from the sun. Why is the difference between day and night

The moon and the earth are at almost the same distance from the sun. Why is the difference between day and night temperatures on the Moon much greater than on Earth?

Due to the presence on Earth of the atmosphere (with its greenhouse effect) and oceans (heat accumulators).

Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.