In this paper, pattern synthesis through time-modulated linear array is studied, and a novel strategy for harmonic beamforming in time-modulated array is proposed. The peak side lobe level is designed as optimization objective function, and the switch-on time sequence of each element is selected as optimization variable. An improved invasive weed optimization (IWO) algorithm is developed in order to determine the optimal parameters describing the pulse sequence used to modulate the excitation weights of array elements. Representative results are reported and discussed to point out potentialities and advantages of the proposed approach, which can obtain lower objective function values.