The invention provides a method for switching between day and night modes of a CCD camera. The beneficial effect of the present invention is that the present invention controls the day-night conversion by replacing the photoresistor with a million CCD video detection technology inside the program. The sensor of the camera itself can transmit the gain value to the back end, that is, the program, and use this gain value to judge the external brightness information. When the brightness is high, the gain value is small, and when the brightness is low, the gain value is large. Therefore, when the light is dark, it needs to be increased. Gain to increase brightness. Conversely, when the gain value is large, it means that the light is very dark, thus controlling the day and night conversion mode of the camera. This makes up for the gap that the gain value cannot be adjusted by the photoresistor and avoids some misjudgments of the photoresistor and repeated switching due to brightness changes caused by turning on and off the infrared lamp.