We examined activity in the frontal cortex as monkeys performed a duration-discrimination task. Two stimuli, one red and the other blue, appeared sequentially on a video screen--in either order. Later, both stimuli reappeared, and to receive a reward the monkeys had to choose the stimulus that had lasted longer during its initial presentation. Some neurons encoded stimulus duration, but a larger number of cells represented their relative duration, which was encoded in three ways: whether the first or second stimulus had lasted longer; whether the red or blue stimulus had lasted longer; or, less commonly, as the difference between the two durations. As the monkeys' choice approached, the signal encoding which stimulus (red or blue) had lasted longer increased as the order-based signal dissipated. By representing stimulus durations and relative durations--both bound to stimulus features and event order--the frontal cortex could contribute to both temporal perception and episodic memory.