Click or drag to resize

SetEpoch Function

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() AS DWORD
Request Example View Source

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