Click or drag to resize

SetEpoch Function (DWord)

X#
Return and optionally change the setting that determines how dates without century digits are interpreted.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION SetEpoch(
	nNewSetting AS DWORD
) AS DWORD
Request Example View Source

Parameters

nNewSetting
Type: DWord
Specifies the base year of a 100-year period in which all dates containing only two year digits are assumed to fall.
The initial default is 1900, causing dates with no century digits to be interpreted as falling within the twentieth century.

Return Value

Type: DWord
If lNewSetting is not specified, SetEpoch() returns the current setting.
If lNewSetting is specified, the previous setting is returned.
Remarks
SetEpoch() is an environment function that determines the interpretation of date strings containing only two year digits. When such a string is converted to a date value, its year digits are compared with the year digits of nNewSetting.
If the year digits in the date are greater than or equal to the year digits of nNewSetting, the date is assumed to fall within the same century as nNewSetting.
Otherwise, the date is assumed to fall in the following century.
Examples
This example shows the effects of SetEpoch():
X#
1SetDateFormat("mm/dd/yyyy")
2? CTOD("05/27/1904")        // 05/27/1904
3? CTOD("05/27/67")        // 05/27/1967
4? CTOD("05/27/04")        // 05/27/1904
5SetEpoch(1960)
6? CTOD("05/27/1904")        // 05/27/1904
7? CTOD("05/27/67")        // 05/27/1967
8? CTOD("05/27/04")        // 05/27/2004
See Also