How long was Gatsby with Dan Cody?
Jay Gatsby sailed with Dan Cody for "five years, during which the boat went three times around the Continent."
After the arrangement ended (when Cody died), Gatsby was promised $25,000, but, through some legal device, he ended up with none of the money.
These five years with Cody are significant throughout the novel. When Nick and Daisy walked through Gatsby's mansion, Nick pointed out "A large photograph of an elderly man in yachting costume" that "hung on the wall over his desk." This place of prominence clearly suggests the role Cody played in Gatsby's growth.
In fact, when Gatsby meets Cody for the first time, he experiences both a symbolic and literal rebirth as James Gatz dies and is reborn as Jay Gatsby. While it's not necessarily mentioned, it can be safely assumed that much of how Gatsby is as the novel takes place is due to his relationship with Cody. At the beginning of these five years, Cody literally redresses Gatsby in "a blue coat, six pairs of white duck trousers, and a yachting cap." The color blue is one of those words that repeats throughout the novel ("blue gardens" and "blue banners" and "blue nose").
Some of Gatsby's seeming lies turn out to be half-truths after Nick reveals the relationship he had with Cody. In Chapter IV, Gatsby describes his past as he "lived like a young rajah in all the capitals of Europe." In reality, he went to the romantic Caribbean islands of the West Indies and the Barbary Coast.