This paper introduces a new estimation method for arbitrary temporal heterogeneity in panel data models. The paper provides a semiparametric method for estimating general patterns of cross-sectional specific time trends. The methods proposed in the paper are related to principal component analysis and estimate the time-varying trend effects using a small number of common functions calculated from the data. An important application for the new estimator is in the estimation of time-varying technical efficiency considered in the stochastic frontier literature. Finite sample performance of the estimators is examined via Monte Carlo simulations. We apply our methods to the analysis of productivity trends in the U.S. banking industry.