Modern floodlights and solar lights have a light sensor to detect day and night. You need to adjust the sensitivity at the time of dusk to get the desired results.