Ask this question to 10 brewers and you'll get 12 different answers.
The short answer is to make sure your final gravity is stable for ~3 days.
Many folks are fermenting for 2-3 weeks in primary only, then bottling/kegging. Others are going longer, others racking to secondary for a week or so, and other cold crashing after 10-14 days.