How long troy bolton been dating Gabriella?

As of High School Musical 3, Troy Bolton and Gabriella Montez had been dating for three years. He attended UC Berkeley to be close to her at Stanford.