Date Handling

How the Perforce server handles dates

Info & Tags

Article #:
32
Created:
04/16/07
Modified:
01/09/08

PROBLEM

How does Perforce handle dates?

SOLUTION

Internal Storage of Dates

Perforce uses the operating system's localtime() and mktime() functions for conversion of dates between internal format and display format. Internally, the date/time in Perforce is represented in seconds since the Epoch (00:00:00 UTC, January 1, 1970). If the system on which the Perforce Server is running has the correct time, the Perforce Server will also have the correct time.

Displaying Dates

Perforce displays dates in the international yyyy/mm/dd format. Perforce uses the operating system's localtime() function call to convert from internal format to display format.

Conversion of Dates

Perforce can accept dates in the range 1970 to 2038, and can be specified using four digits.  Years in the range 1970 and 1999 can also be specified using two digits (70 to 99). 

The Perforce @date file revision specifier (available in Perforce 98.2 and later) interprets dates provided in the following formats:
   yyyy/mm/dd
yy/mm/dd
mm/dd/yy

Perforce allows input dates to be formatted as mm/dd/yy or yy/mm/dd. If the last number is greater than 31, the format 'mm/dd/yy' will be assumed.

Date Calculations

Perforce performs no date calculations other than strict comparisons for sorting purposes. It does not need to handle time spans, and therefore suffers no problems in trying to displaying them.