Psalms 104:19

19 He made the moon to mark the aseasons;
Or  the appointed times (compare Genesis 1:14)

the sun knows its time for setting.
Copyright information for ESV