Psalms 104:19

19He 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