The capacity of batteries is indicated as XXXX mAh (milliampere/hour).
The formula for calculation is as follows:
Capacity (milliampere/hour) = discharge (milliampere) x discharging time (hour)
E.g. Take a Ni-MH rechargeable battery with a capacity of 2000 milliampere/hour.
If you insert this battery into an appliance which consumes 100 milliampere current continuously, the operating time of the appliance will be around 20 hours mathematically. However, this is just a guideline since it varies depending on the performance of the appliance or the conditions it is used in.