Capacity: Measured in ampere-hours, the capacity of a battery can usually be found printed on the battery casing.
Consumption: The average current draw of the electronic device, expressed in amperes.
Discharge Safety: The percentage of the battery that is not utilized.
$$Battery life = Capacity / consumption X (1 - discharge safety)$$
This calculator computes the amount of time for which a battery can supply power to a given circuit.