Duration is the sum of the life of each flow of an asset weighted for the present value of inflows divided by the price:


t = maturity of each cash flow; FC = cash flow; r = yield to maturity; P = price. 
Hence, we will have:

Please note that if we are talking of a zero-coupon bond, then duration is equal to life to maturity. Duration is closer to the final maturity the more the final flow weights.
Ceteris paribus (coupon, coupon frequency, etc...), the bond with higher life to maturity has greater duration.
Duration is a measure of risk of the bond because an increase in duration means a higher volatility of the bond, and therefore a risk of oscillation of the bond price.
Floating rate bonds have low duration since their coupon frequently adapts to market rates, hence their volatility related to market rate movements is low.
On the other hand, fixed rate bonds have higher duration.
The higher is the duration, the higher is the reactivity of bond prices to rates movements.
Editor: Ugo TRENTA