A light-emitting diode (LED) tube lamp comprising a tube, end caps with contact pins and located on both ends of the tube, a first rectifying circuit and a second rectifying circuit and a filtering circuit that are coupled with the contact pins on the two end caps respectively, and a switch circuitry that is located between the rectifying circuits and the filtering circuit characterized in that the switch circuitry is capable of detecting whether the LED tube lamp is correctly installed on a lamp socket so as to reduce the risk of electric shock.