The formula for future value calculations has four variables:

$FV$ = Future Value amount

$PV$ = Present Value amount

$i$ = Rate

$n$ = Number of periods (years)

The fundamental formula is:

$$FV = PV*(1+i)^n$$

To solve for $n$ the formula would be:

$$n = {{log({FV \over PV})} \over {log(1+i)}}$$

By way of example; if €100 is invested and becomes worth €121, and the interest rate is known to be 10% per annum then the solution would be

$$n = {{log({121 \over 100})} \over {log(1+0.10)}} = 2~years$$