This question means both:
- How long can a lightsaber be used in continuous operation?
And, if applicable:
- Does a lightsaber power cell run down when not in use?
According to p.97 of Star Wars Jedi vs. Sith: The Essential Guide to the Force by Ryder Windham,
Every lightsaber has a standard power source, the same type used in small blasters, even in glow panels. They last a long time, though, because Jedi should rarely use their weapons.
This standard power source is a diatium power cell. The excerpt suggests that power loss during periods when the lightsaber is not on is fairly minimal.
Also, recall that Obi-Wan had kept Anakin's lightsaber in a chest for 20 years and it had powered up fine when he gave it to Luke. It seems unlikely that Obi-Wan would have recharged it in the intervening time. (The same lightsaber powered up without issue at Maz Kanata's castle, 30 years after it had been last seen, but what may or may not have been done with it in those decades is far less clear.)
As for continuous operation, there seems to be no direct canon information to answer that part of your question. However, the same books says:
Only Force users are capable of building lightsabers, as it is by the Force that the power cell is initially charged.
This suggests that a truly exceptional Force user may be able to recharge his or her lightsaber on the fly during its operation, effectively removing any limitations on continuous use due to power drainage. However, given the intense, careful concentration required for a Force user to interact with the delicate components of a lightsaber, this seems unlikely.