Like the Earth, the Moon also experiences day and night.
By considering how the Moon is illuminated by the Sun the position of the Sun relative to an observer on Earth can be determined at night by the part of the Moon that is being illuminated.
A general idea of what time it is can also be deduced by considering the position and Phase of the Moon