Our decisions often depend on multiple sensory experiences separated by time delays. The brain can remember these experiences and, simultaneously, estimate the timing between events. To understand the mechanisms underlying working memory and time encoding we analyze neural activity recorded during delays in four experiments on non-human primates. To disambiguate potential mechanisms, we propose two analyses, namely, decoding the passage of time from neural data, and computing the cumulative dimensionality of the neural trajectory over time. Time can be decoded with high precision in tasks where timing information is relevant and with lower precision when irrelevant for performing the task. Neural trajectories are always observed to be low dimensional. These constraints rule out working memory models that rely on constant, sustained activity, and neural networks with high dimensional trajectories, like reservoir networks. Instead, recurrent networks trained with backpropagation capture the time encoding properties and the dimensionality observed in the data.