Long before the Elves awoke, Yavanna created the Two Trees of Valinor to give light to realm of the Valar. So began a reign of peace in Valinor, but Middle-earth was lit by starlight alone, and Melkor worked in the depths of Utumno in the north of the World. We are not told how long this time lasted, just that 'the ages drew on'; this period would have lasted roughly 10,500 years. It was during this period that Aulë made the Dwarves, and at Eru's direction, set them to sleep until the coming of the Elves.

When Oromë discovered that the Elves had awoken at Cuiviénen, great changes came about. The Valar made war on Melkor to protect the Elder Children of Ilúvatar; Utumno was destroyed and Melkor brought in chains to Valinor. The Valar also summoned the Elves to dwell in their land, and many answered this summons.

A period of three ages (about 2,900 years) followed. Melkor was imprisoned in the Halls of Mandos, and the Valar and Eldar dwelt together in the light of the Trees. In the darkness of Middle-earth, the Dark Elves who had not journeyed to Valinor still dwelt, and the Fathers of the Dwarves stirred. Men would not appear until some time after the end of the Years of the Trees.

These Years came to an end when Manwë released Melkor from his imprisonment. For a time, the Dark Lord pretended friendship with the Eldar, but he turned back to the darkness. With Ungoliant, he destroyed the Trees, stole the Silmarils and fled back to the north of Middle-earth. Seeking revenge, Fëanor led a great part of the Noldor out of Valinor and back to Beleriand.

So the Years of the Trees came to an end. At this time, the Valar made the Sun and Moon to give light to the World, and the Years of the Sun began, and with them the First Age.

Reckoning

(i) According to the reckoning by the Trees
12 hours (a full flowering of both Trees) = 1 day
1000 days (12,000 hours) = 1 year
100 years = 1 age of the Valar

(ii) Relation of the reckoning by the Trees to the reckoning by the Sun
1 hour of the Trees = 7 hours of our time
1 day of the Trees = (7 x 12) 84 hours of our time
1 year of the Trees = (7 x 12,000) 84,000 hours of our time
There are (365.25 x 24) 8766 hours in a Sun Year, and thus:
1 year of the Trees = (84,000 / 8766) 9 years, 212 days, 18 hours of the Sun

(iii) Original intention of the Valar for the new reckoning by the Sun and Moon
12 hours of moonlight + 12 hours of sunlight = 24 hours = 1 full day
700 times of sunlight and moonlight = 350 full days = 1 Sun Year
1 hour = 1/7 of 1 hour of the Trees
Therefore:
1 Sun Year would have (24 x 350) 8400 hours = (8400 / 7) 1200 hours of the Trees = 1/10 of a Valian Year (see (i) above); thus 1 Valian Year would = 10 Sun Years
The matter can be expressed more concisely thus:
1 year of the Trees = (7 x 12,000) 84,000 hours of our time
84,000 / (350 x 24) 8400 = 10
but
84,000 / (365.25 x 24) 8766 = 9.582

(iv) The dates of the first flowering of the Trees and the first rising of the Moon
The Trees first flowered after 3500 Valian Years had passed, or 33,530 Sun Years. The Moon first rose after 5000 Valian Years had passed, or 47,901 Sun Years. The Trees shone for 1495 Valian Years, or 14,322 Sun Years.