Command SET EPOCH Foundation

Determines how date values without century digits will be interpreted.

Syntax
SET EPOCH TO <nYear>
Scope
thread-local
Parameters
<nYear>
<nYear> is a positive integer which specifies the first year for a 100 year period of time. All date values whose year number contains only two digits are interpreted as occurring within this period of time.
Description

The conversion of character strings to date values using the function CtoD() uses SET EPOCH to determine the value of character strings where the year is specified using only two digits. If the numeric value of these two digits is greater or equal to the last two digits of <nYear>, the date value created is in the same century as <nYear>. If the last two digits are a lesser value, the date value created is in the following century.

The initial value for SET EPOCH is 1900. This means that all character strings which represent a numeric value of less than 100 (two digits) for the year are converted by CtoD() to a date value in the 20th century. Date values supported by Xbase++ extend from 1/1/0001 to 12/31/9999. Note that today's calendar exists only since the year 1582 (refer to the section "Date" in the chapter "Datatypes and Literals").

Examples
SET EPOCH
// The example demonstrates the effect of SET EPOCH. 

PROCEDURE Main 

   SET DATE FORMAT TO "mm/dd/yyyy" 

   ? CtoD("12/24/1934")          // result: 12/24/1934 
   ? CtoD("12/24/64")            // result: 12/24/1964 
   ? CtoD("12/24/94")            // result: 12/24/1994 

   SET EPOCH TO 1980 

   ? CtoD("12/24/1934")          // result: 12/24/1934 
   ? CtoD("12/24/64")            // result: 12/24/2064 
   ? CtoD("12/24/94")            // result: 12/24/1994 

RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.