xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SET EPOCH

Determines the interpretation of date values without century digits.

Syntax

SET EPOCH TO <nYear>

Arguments

TO <nYear>
This is a numeric value specifying the reference year to which all character strings representing a date without century are compared.

Description

The SET EPOCH command determines the interpretation of date strings that do not carry century digits. Conversion functions such as CtoD() use the value of <nYear> as reference for a century. When decade and year of the string value to convert are larger than or equal to the last two digits of <nYear>, the value is assumed to fall into the same century like <nYear>. When the value is smaller, it is assumed to fall into the next century.

By default, SET EPOCH is 1900 so dates without century digits will fall into the twentieth century. xHarbour supports dates from 01/01/0100 to 12/31/2999.

Info

See also:CtoD(), Date(), DtoC(), DtoS(), Set(), SET CENTURY, SET DATE
Category: SET commands
Source:rtl\set.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates the effect or a reference year set with
// SET EPOCH:

   PROCEDURE Main
      SET DATE FORMAT TO "mm/dd/yyyy"
      ? CtoD("05/27/1903")            // Result: 05/27/1903
      ? CtoD("05/27/55")              // Result: 05/27/1955

      SET EPOCH TO 1950
      ? CtoD("05/27/1910")            // Result: 05/27/1910
      ? CtoD("05/27/69")              // Result: 05/27/1969
      ? CtoD("05/27/06")              // Result: 05/27/2006
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe