How many years does it take to form a diamond?

The formation of diamonds does not take a long time, it can actually be near to instantaneous (in geological terms). The problem in creating diamonds is to bring the raw material (carbon) into the suitable pressure range where diamond becomes the stable polymorph of carbon. Rocks from the depths where these pressures are achieved are found in areas of very old continental areas (like South Africa). They are known as kimberlites - very rapidly erupting rocks that host the diamonds.

If the ascend of those rocks is to slow, the diamonds convert into graphite on the way as diamond is not stable under surface conditions and when slowly being depressured and cooled the transformation to graphite can take place somewhere in the continental crust. On the surface diamonds do not transform back to graphite because the kinetics of such a transformation are inhibited (its just to cold).

Kimberlites have been dated to be very old (several billion years old) but it did not take the diamonds so long to form (there are even some facilities that can industrially produce diamonds).