) Both sentences are correct and have a similar meaning: you are asking someone to give you the duration in years of the period of his solitary life. There is a nuance here. The first sentence is the regular question in this context and the one most often heard - and the more polite sentence.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.