sx_SetEpoch

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_SetEpoch

VB Declaration

Declare Sub sx_SetEpoch Lib "Apollo9.dll"

(ByVal iBaseYear As Integer)

As Integer

C Declaration

USHORT FAR PASCAL sx_SetEpoch

(USHORT uiBaseYear);

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 iBaseYear. If the year digits in the date are greater than or equal to the year digits of iBaseYear, the date is assumed to fall within the same century as iBaseYear. Otherwise, the date is assumed to fall in the following century.

Parameters

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

 

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

VB Example

sx_SetCentury True

s1 = sx_EvalString( "CTOD( '05/27/1904' )" ) ' 05/27/1904

s2 = sx_EvalString( "CTOD( '05/27/67' )" ) ' 05/27/1967

s3 = sx_EvalString( "CTOD( '05/27/04' )" ) ' 05/27/1904

 

sx_SetEpoch( 1960 )

s4 = sx_EvalString( "CTOD( '05/27/1904' )" ) ' 05/27/1904

s5 = sx_EvalString( "CTOD( '05/27/67' )" ) ' 05/27/1967

s6 = sx_EvalString( "CTOD( '05/27/04' )" ) ' 05/27/2004

C Example

sx_SetCentury( TRUE );

 

// 05/27/1904

lstrcpy( (LPSTR) s1, (LPSTR) sx_EvalString( "CTOD( '05/27/1904' )" ));

// 05/27/1967

lstrcpy( (LPSTR) s2, (LPSTR) sx_EvalString( "CTOD( '05/27/1967' )" ));

// 05/27/1904

lstrcpy( (LPSTR) s3, (LPSTR) sx_EvalString( "CTOD( '05/27/04' )" ));

sx_SetEpoch( 1960 );

// 05/27/1904

lstrcpy( (LPSTR) s4, (LPSTR) sx_EvalString( "CTOD( '05/27/1904' )" ));

// 05/27/1967

lstrcpy( (LPSTR) s5, (LPSTR) sx_EvalString( "CTOD( '05/27/1967' )" ));

// 05/27/2004

lstrcpy( (LPSTR) s6, (LPSTR) sx_EvalString( "CTOD( '05/27/04' )" ));

See Also

sx_SetDateFormat, sx_SetCentury