Sometimes customers ask us to change just a single string. In exceptional cases, you can do that, especially when it comes to the D string. It is particularly susceptible to rupture. Usually one should change the whole set of strings.
Tuned strings are constantly stretched. This tires the material, which means that the string after a certain time has no more elasticity. A broken string is a signal that you have already missed the right time to change strings.
Time to change strings is when the strings hardly need to be tuned. The point where the string is touching the fret when playing, no longer moves. This is easily recognised by the dark spot at these points on the bass strings. Of course, it still depends on some individual factors such as sweat and the amount of finger pressure, but after about 40 hours of playing time has come.