Determining the knot number and location is the most challenging problem in spline fitting. In this paper, we proposed a two-stage framework for calculating knots in spline fitting based on the unimodality property. Here, the unimodality property means that the jumps of the highest order derivative of the B-spline approximation at the initial knots closest to the true knots from the sampled B-spline are local maximal. Thus, in the first step, we search for the knots associated with local maximal jumps to locate in which intervals true knots should be. Here, the sliding window algorithm is adopted to search for the knots from an initial knot vector. Then, the knots selected in the first step are adjusted locally to reduce the knot number and improve fitting performance. Furthermore, we provide an error estimation for the B-spline approximation when data points are sampled uniformly and densely from a spline, and the initial knots are chosen as the parametrization for the data points. Such an estimation provides evidence of the unimodality of the least squares B-spline approximation. The proposed method is a significant improvement upon the method used in Kang et al. (2015) based on algorithm efficiency and fitting performance.