Date and Calendar Analytics
Country's Calendar functions

A set of functions for exploring country-based calendar for use in calendar and business date calculations. More...

Functions

int __stdcall SFDB_ISVALIDCNTRYCODE (LPCTSTR argCode)
 Return TRUE if the country code is a valid ISO country code (2 or 3 characters)
 
int __stdcall SFDB_GETWKNDFROMCNTRY (LPCTSTR argCode, LPTSTR retVal, size_t *nLen)
 Return the weekend convention of the government calendar of the given country.
 
int __stdcall SFDB_GETCALFROMCNTRY (LPCTSTR argCode, LPTSTR retVal, size_t *nLen)
 Return the calendar code associated with the given country.
 

Detailed Description

The API comes with pre-defined list of calendars adopted by the government of different countries.

Function Documentation

◆ SFDB_GETCALFROMCNTRY()

int __stdcall SFDB_GETCALFROMCNTRY ( LPCTSTR argCode,
LPTSTR retVal,
size_t * nLen )

Return the calendar code associated with the given country

Parameters
[in]argCode(Required) the ISO country code (e.g. US, GB, USA, GBR, etc.).
[out]retVal(Optional) the buffer that will receive the calendar code.
[in,out]nLen(Required) The maximum number of characters to copy to the buffer.
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
Return values
NDK_SUCCESSsuccess
NDK_INVALID_ARGfailed (see remarks)
NDK_INVALID_VALUEfailed (see remarks)
NDK_FAILEDfailed
Remarks
  1. The list of calendar definitions can be found here.
  2. If the calendar module has not been initialized, the function will fail and return NDK_FAILED as the return code.
  3. The function is available in the lite (free) version without any restrictions.
  4. If the value of argCode is NULL or empty string, the function will fail and return NDK_INVALID_ARG as error code.
  5. If the value of nLen is NULL, the function will fail and return NDK_INVALID_ARG as error code.
  6. If retVal is NULL, the function returns NDK_SUCCESS and stores the required size of the data, in characters, in the variable pointed to by nLen. This enables an application to determine the best way to allocate a buffer for the value's data.
  7. If the value of the retVal is not NULL, but the buffer size (specififed by *nLen) is smaller than needed, the function will fail and return NDK_LENGTH_ERROR as error code.
Demo
nRetCode = SFDB_GETCALFROMCNTRY(L"GB", &szBuffer[0],&nLen);
if(nRetCode == NDK_SUCCESS){
std::wstring szCalCode = &szBuffer[0];
std::wcout << L" SUCCESS - SFDB_GETCALFROMCNTRY for GB is: " << szCalCode << std::endl;
Requirements
Requirement Value
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
SFLUC.dll
SFLOG.dll
Since
v1.56
See also
Examples
country.cpp.

◆ SFDB_GETWKNDFROMCNTRY()

int __stdcall SFDB_GETWKNDFROMCNTRY ( LPCTSTR argCode,
LPTSTR retVal,
size_t * nLen )

Return the weekend code (i.e. 7 characters) associated with the given country

Parameters
[in]argCode(Required) the ISO country code (e.g. US, GB, USA, GBR, etc.).
[out]retVal(Optional) the buffer that will receive the weekend code.
[in,out]nLen(Required) The maximum number of characters to copy to the buffer.
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
Return values
NDK_SUCCESSsuccess
NDK_INVALID_ARGfailed (see remarks)
NDK_LENGTH_ERRORfailed (see remarks)
NDK_FAILEDfailed
Remarks
  1. The list of calendar definitions can be found here.
  2. If the calendar module has not been initialized, the function will fail and return NDK_FAILED as the return code.
  3. The function is available in the lite (free) version without any restrictions.
  4. If the value of argCalCode is NULL or empty string, the function will fail and return NDK_INVALID_ARG as error code.
  5. If the value of nLen is NULL, the function will fail and return NDK_INVALID_ARG as error code.
  6. If retVal is NULL, the function returns NDK_SUCCESS and stores the required size of the data, in characters, in the variable pointed to by nLen. This enables an application to determine the best way to allocate a buffer for the value's data.
  7. If the value of the retVal is not NULL, but the buffer size (specififed by *nLen) is smaller than needed, the function will fail and return NDK_LENGTH_ERROR as error code.
Demo
std::wstring szCode(TEXT("GB"));
size_t nLen=28;
std::vector<TCHAR> szBuffer(nLen, 0x00);
nRetCode = SFDB_GETWKNDFROMCNTRY(L"GB", &szBuffer[0],&nLen); // Expected: 0000011
if(nRetCode == NDK_SUCCESS){
std::wstring szWknCode = &szBuffer[0];
std::wcout << L" SUCCESS - SFDB_GETWKNDFROMCNTRY for GB is: " << szWknCode << std::endl;
Requirements
Requirement Value
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
SFLUC.dll
SFLOG.dll
Since
v1.56
See also
Examples
country.cpp.

◆ SFDB_ISVALIDCNTRYCODE()

int __stdcall SFDB_ISVALIDCNTRYCODE ( LPCTSTR argCode)

Return TRUE if the country code is a valid ISO country code (2 or 3 characters)

Parameters
[in]argCode(Required) the ISO country code (e.g. US, GB, USA, GBR, etc.).
Returns
status code of the function call: NDK_TRUE, NDK_FALSE, and negative = error occurred.
Return values
NDK_TRUEsuccess (TRUE)
NDK_FALSEsuccess (FALSE)
NDK_INVALID_ARGfailed (see remarks)
NDK_INVALID_VALUEfailed (see remarks)
NDK_FAILEDfailed
Remarks
  1. The list of calendar definitions can be found here.
  2. If the calendar module has not been initialized, the function will fail and return NDK_FAILED as the return code.
  3. The function is available in the lite (free) version without any restrictions.
  4. If the value of argCalCode is NULL or empty string, the function will fail and return NDK_INVALID_ARG as error code.
Demo
int nRetCode = SFDB_ISVALIDCNTRYCODE(L"US");
if( nRetCode == NDK_TRUE){
std::wcout << L" SUCCESS - SFDB_ISVALIDCNTRYCODE for US is valid." << std::endl;
nRetCode = SFDB_ISVALIDCNTRYCODE(L"GBR");
if( nRetCode == NDK_TRUE){
std::wcout << L" SUCCESS - SFDB_ISVALIDCNTRYCODE for GBR is valid." << std::endl;
Requirements
Requirement Value
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
SFLUC.dll
SFLOG.dll
Since
v1.56
See also
Examples
country.cpp.