John Carter, a Confederate veteran of the American Civil War, goes prospecting in Arizona immediately after the war's end. Having struck a rich vein of gold, he runs afoul of the Apaches. While attempting to evade pursuit by hiding in a sacred cave, he is mysteriously transported to Mars, called "Barsoom" by its inhabitants. Carter finds that he has great strength and superhuman agility in this new environment as a result of its lesser gravity and lower atmospheric pressure. He soon falls in with a nomadic tribe of Green Martians, or Tharks, as the planet's warlike, six-limbed, green-skinned inhabitants are known. Thanks to his strength and martial prowess, Carter rises to a high position in the tribe and earns the respect and eventually the friendship of Tars Tarkas, one of the Thark chiefs.
The Tharks subsequently capture Dejah Thoris, Princess of Helium, a member of the humanoid red Martian race. The red Martians inhabit a loose network of city-states and control the desert planet's canals, along which its agriculture is concentrated. Carter rescues Dejah Thoris from the green men in a bid to return her to her people.
Subsequently Carter becomes embroiled in the political affairs of both the red and green Martians in his efforts to safeguard Dejah Thoris, eventually leading a horde of Tharks against the city-state of Zodanga, the historic enemy of Helium. Winning Dejah Thoris' heart, he becomes Prince of Helium, and the two live happily together for nine years. However, the sudden breakdown of the Atmosphere Plant that sustains the planet's waning air supply endangers all life on Barsoom. In a desperate attempt to save the planet's inhabitants, Carter uses a secret telepathic code to enter the factory, bringing an engineer along who can restore its functionality. Carter then succumbs to asphyxiation, only to awaken back on Earth, left to wonder what has become of Barsoom and his beloved.

Question: For how long did Carter and Dejah live happily together? 
Answer: Nine years
Alternative answer: Nine years.