Solar heating of Earth
 

Daytime is when the sun heats the earth’s surface via radiation.  At night the earth loses heat by radiation.  Because there is a balance the earth has stayed at a nearly constant temperature for a very long time.