There are not the details that would make this clear.
(a) if the person replying is a pilot, and the question is, "How long have you been flying planes?"
Then - two years would be the most sensible alternative.
(b) if the person replying is a student pilot, then he could be referring to the number of flying hours he has so far, and so "two hours" is more likely.
(c) if the pilot and first officer are taking turns at the controls, then someone who hasn't been in the cockpit until this stage of the flight might be asking the question, and so "two hours" would be the only possible alternative.