According to the Bible, on the fourth day, God created lights in the expanse that separates the waters on the earth from the waters above the expanse.
"And God said, Let there be lights in the firmament of the heaven to divide the day from the night; and let them be for signs, and for seasons, and for days, and years: And let them be for lights in the firmament of the heaven to give light upon the earth: and it was so. And God made two great lights; the greater light to rule the day, and the lesser light to rule the night: he made the stars also. And God set them in the firmament of the heaven to give light upon the earth, And to rule over the day and over the night, and to divide the light from the darkness: and God saw that it was good. And the evening and the morning were the fourth day."Genesis 1:14-19
The purposes for the lights differ from our modern understanding.
The Bible says the lights are for signs or omens. Ancient peoples of whatever religion (as well as the superstitious among us today) believed that their god or gods communicated through astronomical phenomena. Today, of course, we understand eclipses, "shooting stars," etc. strictly in terms of the physical structure of the universe.
The Bible says that the lights are for seasons, or appointed times and assemblies. The ancient Hebrews organized their religious festivals around the Sun, stars, and the cycles of the moon. Most moderns societies do not organize religious or political assemblies around astronomical phenomena.
The Bible says that the lights are for days and years. We, too, use the sun for marking off days. We do not, however, see the sun and moon created for that purpose. And unlike the ancient Hebrews, we know that the rotation of the earth creates the days and the orbit of the earth marks the years.
These lights are said to divide the day from the night. This is a bit redundant, since God divided the day from the night already when he created the first day. Giving light to the earth is a bit redundant as well since God created light on the first day.
The passage describing the sun and moon to "rule" the day and night is the most interesting. This passage means that the "day" is the dominion or place of the sun and the "night" is the dominion or place of the moon. But the place of the sun and moon, day and night, are located "in the firmament" or dome over the land. From the perspective of the biblical authors, the sun, moon, and star are not thousands or millions of miles distant; their dominion is immediately above us.
Another great video from the Bible Skeptic over at YouTube: