Fermat wrote
I have discovered a truly remarkable proof which this margin is too small to contain. Fermat almost certainly wrote the marginal note around 1630, when he first studied Diophantus's Arithmetica.
----
In August 1994 Wiles addressed the International Congress of Mathematicians but was no nearer to solving the difficulties.
Taylor suggested a last attempt to extend Flach's method in the way necessary and Wiles, although convinced it would not work, agreed mainly to enable him to convince Taylor that it could never work. Wiles worked on it for about two weeks, then suddenly inspiration struck.
In a flash I saw that the thing that stopped it [the extension of Flach's method] working was something that would make another method I had tried previously work.
On 6 October Wiles sent the new proof to three colleagues including Faltings. All liked the new proof which was essentially simpler than the earlier one. Faltings sent a simplification of part of the proof. -
Article by: J J O'Connor and E F Robertson for School of Mathematics and Statistics--------
This gives us 1994 as the year of solution, as do the all the other sources. But the year of the first attempt, of Fermat's writing the notation in the margin, is uncertain. Using 1630, we have a time period of 364 years. Guinness also gives 1630, while Wikipedia gives 1637. Many sources avoid giving an exact date. Looking around at .edu sites, I found that most avoid an exact date, but of those that do give a year, 1630 appeared more than any later date.
Both Wikipedia and Guinness are excellent sources, but I have seen errors in both. Wikipedia is, and always will be, a work in progress, while Guinness is, in matters like this, more of a collector of established facts.
If I remember correctly, isn't it somewhat of a given that, in general, a mathematician's original output usually takes place by the time he is 30 or so? Assuming that this generalization is relatively valid even for those in the 1600s, if I had to choose a year, I would choose 1630, but I also wouldn't be certain that I was right. I also note that 1630 as the year that Fermat "first studied Diophantus's Arithmetica" was not disputed by any sources that I looked at. Has anyone looked at the date(s) given by the most widely recognized schools of mathamatics?
(Please note that I have avoided giving anything that could be construed as a definitive answer. I'm rather proud of that.

)