A method for modeling a changing periodic pattern is developed. The use of time-varying splines enables this to be done relatively parsimoniously. The method is applied in a model used to forecast hourly electricity demand, with the periodic movements being intradaily or intraweekly. The full model contains other components, including a temperature response, which is also modeled using splines.