SetEpoch

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloEnv > TApolloEnv Methods >

SetEpoch

Declaration

function SetEpoch( const iYear: Integer ) : Integer;

Description

Determines the interpretation of date strings with only two year digits. When such a string is converted to a date value, its year digits are compared with the year digits of iYear. If the year digits in the date are greater than or equal to the year digits of iYear, the date is assumed to fall within the same century as iYear. Otherwise, the date is assumed to fall in the following century.

Parameters

iYear specifies the base yaer of a 100-year period in which all dates containing only two year digits are assumed to fall.

 

The default epoch value is 1980, causing dates with no century digits to be interpreted as falling within the twentieth century.

Delphi Example

with ApTbl do

begin

 ApolloEnv1.SetCentury( True ); 

 s1 := EvalString( 'CTOD( "05/27/1904" )' ); // 05/27/1904 

 s2 := EvalString( 'CTOD( "05/27/67" )' ); // 05/27/2067 

 s3 := EvalString( 'CTOD( "05/27/04" )' ); // 05/27/2004 

 

 ApolloEnv1.SetEpoch( 1960 );

 s4 := EvalString( 'CTOD( "05/27/1904" )' ); // 05/27/1904

 s5 := EvalString( 'CTOD( "05/27/67" )' ); // 05/27/1967

 s6 := EvalString( 'CTOD( "05/27/04" )' ); // 05/27/2004 

end;

See Also

Epoch, SetDateFormat, SetCentury