They hatch underground but dig their way out generally in the late evening or night. You ask how do they know if it is day or night from underground? They know by the sand temperature. This doesn’t always work because a cloudy day or a storm can also lower the sand temperature. They have the best chance of survival at night because the sea gulls and other predators don’t see them and have a feast!