Date and Calendar Analytics
Weekend based Calculations.

functions for weekends-based date calculations. More...

Functions

int __stdcall SFDB_ISVALIDWKND (LPCTSTR argCode)
 examines whether the given code corresponds to valid weekend convention.
 
int __stdcall SFDB_WKNDCode (WORD argNumber, LPTSTR retVal, size_t *pLen)
 Returns the seven-character string code for a weekend-number (1-7, 11-17).
 
int __stdcall SFDB_WKNDNo (LPCTSTR argCode, LPWORD retVal)
 Returns the weekend-number (1-7 or 11-17) for a given country or a weekend code.
 
int __stdcall SFDB_ISWKND (LONG argDate, LPCTSTR holidays, LPLONG zDates, size_t nSize, WORD nWkndNo, WORD argOptions)
 Returns TRUE if the reference date falls on a (short/long) weekend.
 
int __stdcall SFDB_WKNDur (LONG argDate, LPCTSTR holidays, LPLONG zDates, size_t nSize, WORD nWkndNo, LPWORD retVal)
 Returns the duration (in calendar days) of the (long) weekend that a given day falls on.

 
int __stdcall SFDB_WKNDate (LONG argDate, LPCTSTR holidays, LPLONG zDates, size_t nSize, WORD nWkndNo, WORD argLWkndOption, WORD argDirection, LPLONG retVal)
 Returns the serial date number that corresponds to the first (last) day in the next (last) weekend

 

Detailed Description

Function Documentation

◆ SFDB_ISVALIDWKND()

int __stdcall SFDB_ISVALIDWKND ( LPCTSTR argCode)
Parameters
[in]argCode(Required) is the given weekend code or number.
Returns
status code of the function call: NDK_TRUE, NDK_FALSE, and negative = error occurred.
Return values
NDK_TRUEgiven date falls on holiday
NDK_FALSEgiven date does not fall on holiday
ElseError code
See also
SFDB_WKNDNo()
Remarks
Example
Requirements
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
Since
v1.68
Parameters
[in]argCodeis the given weekend code or number

◆ SFDB_ISWKND()

int __stdcall SFDB_ISWKND ( LONG argDate,
LPCTSTR holidays,
LPLONG zDates,
size_t nSize,
WORD nWkndNo,
WORD argOptions )
Parameters
[in]argDate(Required) a serial date number that represents a given date.
[in]holidays(Optional) a (:_:) separated list of holiday codes.
[in]zDates(Optional) an array of holidays dates; each expressed as a serial number (i.e. number of days since 1.1.1970) .
[in]nSize(Required) the number of holiday dates in zDates.
[in]nWkndNo(Required) the weekend number (1-7, 11-17).
[in]argOptions(Required) is a switch to specify how to test for short or long weekends (1 = all (default), 2 = ignore holidays, 3 = only short weekends, 4 = only long weekends).
  1. All (default)
  2. Ignore holidays (same as (1), but treats long weekend as short)
  3. Only short weekends
  4. Only long weekends
Returns
status code of the function call: NDK_TRUE, NDK_FALSE, and negative = error occurred.
Return values
NDK_TRUEdate falls on a weekend
NDK_FALSEdate does not fall on a weekend
NDK_FAILEDOperation unsuccessful.
See also
SFDB_ISWRKDY()
Remarks
Example
Requirements
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
Since
v1.68

◆ SFDB_WKNDate()

int __stdcall SFDB_WKNDate ( LONG argDate,
LPCTSTR holidays,
LPLONG zDates,
size_t nSize,
WORD nWkndNo,
WORD argLWkndOption,
WORD argDirection,
LPLONG retVal )
Parameters
[in]argDate(Required) a serial date number that represents a given date.
[in]holidays(Optional) a (:_:) separated list of holiday codes.
[in]zDates(Optional) an array of holidays dates; each expressed as a serial number (i.e. number of days since 1.1.1970) .
[in]nSize(Required) the number of holiday dates in zDates.
[in]nWkndNo(Required) the weekend number (1-7, 11-17).
[in]argLWkndOption(Required) a switch to specify how to test for short or long weekends (1 = all (default), 2 = ignore holidays, 3 = only short weekends, 4 = only long weekends).
[in]argDirection(Required) a switch to select the return output (1 = next weekend (default), 2 = last weekend).
[out]retVal(Required) the serial date number of the next/previous weekend.
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
Return values
NDK_SUCCESSsuccess
NDK_FAILEDerror
See also
SFDB_ISWRKDY()
Remarks
Example
Requirements
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
Since
v1.68

◆ SFDB_WKNDCode()

int __stdcall SFDB_WKNDCode ( WORD argNumber,
LPTSTR retVal,
size_t * pLen )
Parameters
[in]argNumber(Required) The weekend number (1-7, 11-17).
[out]retVal(Required) The buffer that will receive the string code.
[in,out]pLen(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_FAILEDerror
See also
SFDB_WKNDNo()
Remarks
Example
Requirements
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
Since
v1.68

◆ SFDB_WKNDNo()

int __stdcall SFDB_WKNDNo ( LPCTSTR argCode,
LPWORD retVal )
Parameters
[in]argCode(Required) the weekend 7-character string code.
[out]retVal(Required) The weekend number (1-7, 11-17).
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
Return values
NDK_SUCCESSsuccess
NDK_FAILEDerror
See also
SFDB_ISWRKDY()
Remarks
Example
Requirements
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
Since
v1.68

◆ SFDB_WKNDur()

int __stdcall SFDB_WKNDur ( LONG argDate,
LPCTSTR holidays,
LPLONG zDates,
size_t nSize,
WORD nWkndNo,
LPWORD retVal )
Parameters
[in]argDate(Required) a serial date number that represents a given date.
[in]holidays(Optional) a (:_:) separated list of holiday codes.
[in]zDates(Optional) an array of holidays dates; each expressed as a serial number (i.e. number of days since 1.1.1970) .
[in]nSize(Required) the number of holiday dates in zDates.
[in]nWkndNo(Required) the weekend number (1-7, 11-17).
[out]retVal(Required) the number of calendar days in the given weekend.
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
Return values
NDK_SUCCESSsuccess
NDK_FAILEDerror
See also
SFDB_ISWRKDY()
Remarks
Example
Requirements
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
Since
v1.68