How long do you have to get the ball across the midcourt line? is it 8 seconds

Look for backcourt violation.
http://www.usabasketball.com/rules/rules.html

According to the official basketball rules, a team has 8 seconds to advance the ball past the midcourt line from the backcourt after gaining possession. This is known as the "8-second violation" or "backcourt violation." If a team fails to cross the midcourt line within the allotted time, it results in a turnover and the opposing team is awarded possession. To find more information about basketball rules and various violations, you can refer to websites such as usabasketball.com or any official basketball rulebook.