Edit 2In light of the discission at wiki.fr letme add a couple of additional remarks along with a promise that a nonelectronicpublication of my views on Fermat will appear within the next two years (if I canfind a publisher, that is).
A search in google books for "hanc marginis" and Fermat for theyears up to 1900 reveals several hits, none of which claims that the remark was written around 1637; in particular there are no datesgiven in Fermat's Oeuvres or in Heath's Diophantus. Starting with Dickson's history, this changes dramatically, and nowadays the date 1637 seems to be firmly attached to this entry.
The dating of the entry seems to come from a letter written byFermat to J. de Sainte-Croix via Mersenne mentioned in Nurdin's answer; this letter is not dated, but since Descartes, in a letter to Mersenne from 1638, refers to a result he credits to Sainte-Croix, but which Fermat claims he has discovered, it is believed that Fermat's letter to Mersenne was written well before that date. The reasons for dating it to September 1636 are not explained in Fermat's Oeuvres.
In this letter, Fermat poses the problem of finding two fourthpowers whose sum is a fourth power, and of finding two cubes whosesum is a cube. The reasoning seems to be that in 1636, Fermathad not yet found (or believed to have found) a proof of the general theorem, so the entry must have been written at a later date. Since he did not refer to the general theorem in any of his existant letters, it is also believed that he soon found his mistake, so the entry cannot have been written at a time whenFermat was mature enough to find sufficiently difficult proofs.
Let me also add that the following dates can be deduced from Fermat's letters:
It is impossible to attach any dates between 1644 and 1654 toFermat's discoveries since he either wrote hardly any letterin this period, or all of them are lost.
Fermat claimed to have discovered infinite descent in connectionwith results such as (1), and that he at first could apply itonly to negative statements such as (2), whereas it took him a long time until he could use his method for proving positive statements such as (3). Thus the proofs of (1) - (2) - (3) werefound in this order.
This means in particular that if Fermat's entry in his Diophantuswas written around 1637, then the marvellous proof must have beena proof that does not use infinite descent.
I would also like to remark that the Fermat equation for exponents3 and 4 had already been studied by Arab mathematicians, such as Al-Khujandi and Al-Khazin, who both attempted proving that thereare no solutions. The cubic equation also shows up in problemsposed by Frenicle and van Schooten in response to Fermat'schallenge to the English mathematicians.

