The hippocampus encodes the temporal relationship between events, but how it does this over both short (seconds to minutes) and long (hours to days) timescales is not known. Here, neuronal activity in CA1 pyramidal cells was measured while mice ran on a treadmill to receive a sucrose reward. Ensembles of CA1 pyramidal cells that exhibited sequences of spiking that differed over different timescales (‘time cells’) were monitored using in vivo calcium imaging. The same time cells that encode temporal information over seconds also encode information over longer timescales in which the ensemble of neurons involved gradually change over time.