Solving ordinary differential equations (ODEs) is vital in diverse fields. However, it is difficult to obtain the exact analytical solutions of ODEs due to their changeable mathematical forms. Traditional numerical methods can find approximate solutions for specific ODEs. Unfortunately, they often suffer from ODEs' forms and characteristics. To approximate different types of ODEs, this paper proposes a generic method based on adaptive differential evolution. Besides, in order to further reduce the error of the obtained approximate solutions, an improved Fourier periodic expansion function is developed, which is then combined with the least square weight method to formulate the ODEs as an optimization problem. Since the proposed method is not limited to ODEs' forms and constraint conditions, it can be used to approximate any ODEs, including linear ODEs and nonlinear ODEs. The proposed method is evaluated on twenty popular test cases. The results indicate that the proposed method is able to accurately approximate different ODEs with better performance compared with other methods.