How long must you shine a UV light to disinfect something?
That really depends on the strength of the UV-C light source. You can forget about using any LED based light source as those are either fake or the UV light is the wrong wavelength and most importantly, they do not put out sufficient amounts of energy.
UV lights that are listed as germicidal need to be emitting in the UV-C band of light, with a spectral wavelength at 254 nanometers. That is one of the predominant emission wavelengths of a low pressure mercury bulb. You will also need to have a sufficient wattage of the bulb and you need to know the amount of energy deposited to defined area. This is usually expressed in J/m^2 or mW/cm^2 at a specified distance from the bulb over a defined period of time.
Once you know those numbers, it is pretty easy to figure out how much time you need to disinfect a SURFACE. You see, UV is only good for disinfecting a surface, or water (if being circulated). BUT - how do you know the time? You need a bit of physics but it is relatively simple as one J (joule) per second is a watt.
To figure out the time, a bulb that emits 10 J/m^2 in one second is equal to a bulb that emits 1 milliwatt per cm^2. From here it is pretty simple. If you need a dose of 10 J/m^2 and your bulb only has energy of say, 50 microwatts/cm^2, you will need to exposure the surface for about 20 seconds at the defined distance.
If you change the distance, the calculations are bit more complicated. Also using UV light has other hazards as well to anyone who using the light. To be safe, use something else such a dilute solution of bleach.