functions for exploring weekend-conventions and incorporating into calendar and business date calculations.
More...
|
int __stdcall | SFDB_ISVALIDWKND (LPCTSTR argCode) |
| Assess whether the provided code adheres to the valid weekend convention (TRUE/FALSE).
|
|
int __stdcall | SFDB_WKNDCode (WORD argNumber, LPTSTR retVal, size_t *pLen) |
| Create a seven-character string code for a specified weekend number (ranging from 1 to 7 or 11 to 17).
|
|
int __stdcall | SFDB_WKNDNo (LPCTSTR argCode, LPWORD retVal) |
| Return the corresponding weekend-number (1-7 or 11-17) for a given weekend code.
|
|
int __stdcall | SFDB_ISWKND (LONG argDate, LPCTSTR holidays, LPLONG zDates, size_t nSize, WORD nWkndNo, WORD argOptions) |
| Examine the given date whether it falls on a (short/long) weekend.
|
|
int __stdcall | SFDB_WKNDur (LONG argDate, LPCTSTR holidays, LPLONG zDates, size_t nSize, WORD nWkndNo, LPWORD retVal) |
| Calculate the duration in calendar days of the long weekend that a given date falls on.
|
|
int __stdcall | SFDB_WKNDate (LONG argDate, LPCTSTR holidays, LPLONG zDates, size_t nSize, WORD nWkndNo, WORD argLWkndOption, WORD argDirection, LPLONG retVal) |
| Calculate the serial date number for the first day of the next weekend (or the last day of the last weekend).
|
|
As of Excel 2007, Microsoft supports different weekend occurrences in the international version of the date functions (e.g., WORKDAY.INTL). The weekend conventions are defined by either a number or a seven-character string (code).
Weekend conventions specify which days of the week are weekends. The weekend convention is defined by a weekend number (1-7 and 11-17) or a string. Weekend string values are seven characters long, and each character represents a day of the week, starting with Monday. 1 depicts a non-workday, and 0 represents a workday. Only the characters 1 and 0 are permitted in the string. 1111111 is an invalid string, for example.
The weekend number (and weekend string) values indicate the following weekend days:
Weekend-Number | Weekend Days | Weekend Code |
1 | Saturday, Sunday | 0000011 |
2 | Sunday, Monday | 1000001 |
3 | Monday, Tuesday | 1100000 |
4 | Tuesday, Wednesday | 0110000 |
5 | Wednesday, Thursday | 0011000 |
6 | Thursday, Friday | 0001100 |
7 | Friday, Saturday | 0000110 |
11 | Sunday only | 0000001 |
12 | Monday only | 1000000 |
13 | Tuesday only | 0100000 |
14 | Wednesday only | 0010000 |
15 | Thursday only | 0001000 |
16 | Friday only | 0000100 |
17 | Saturday only | 0000010 |
- References
-
- Related Links
-
◆ SFDB_ISVALIDWKND()
int __stdcall SFDB_ISVALIDWKND |
( |
LPCTSTR | argCode | ) |
|
Assess whether the provided code adheres to the valid weekend convention (TRUE/FALSE)
- 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
-
- 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
-
◆ SFDB_ISWKND()
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.
- 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:
Value | Option |
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
-
- 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
-
◆ SFDB_WKNDate()
int __stdcall SFDB_WKNDate |
( |
LONG | argDate, |
|
|
LPCTSTR | holidays, |
|
|
LPLONG | zDates, |
|
|
size_t | nSize, |
|
|
WORD | nWkndNo, |
|
|
WORD | argLWkndOption, |
|
|
WORD | argDirection, |
|
|
LPLONG | retVal ) |
Calculate the serial date number for the first day of the next weekend (or the last day of the last weekend).
- 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:
Value | Option |
1 | All (default) |
2 | Ignore holidays (same as (1), but treats long weekend as short) |
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
-
- Demo
long dt = 41030;
std::wstring szHolidays;
WORD wkndNo = 1;
WORD wkdOption = 1;
WORD direction = 1;
long lNextWknd = 0;
int nRetCode =
SFDB_WKNDate(dt, NULL, NULL, 0, wkndNo, wkdOption, direction, &lNextWknd);
std::wcout << L" SUCCESS - SFDB_WKNDate for next weekend: " << lNextWknd << std::endl;
WORD wDur=0;
nRetCode =
SFDB_WKNDur (lNextWknd, NULL, NULL, 0, wkndNo, &wDur);
std::wcout << L" SUCCESS - the duration SFDB_WKNDur for a given weekend: " << wDur << 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
- wknd_date.cpp.
◆ SFDB_WKNDCode()
int __stdcall SFDB_WKNDCode |
( |
WORD | argNumber, |
|
|
LPTSTR | retVal, |
|
|
size_t * | pLen ) |
Create a seven-character string code for a specified weekend number (ranging from 1 to 7 or 11 to 17).
- Parameters
-
[in] | argNumber | (Required) The weekend number (1-7, 11-17). |
[out] | retVal | (Optional) 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
-
- 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
-
◆ SFDB_WKNDNo()
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.
- 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
-
- 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
-
◆ SFDB_WKNDur()
int __stdcall SFDB_WKNDur |
( |
LONG | argDate, |
|
|
LPCTSTR | holidays, |
|
|
LPLONG | zDates, |
|
|
size_t | nSize, |
|
|
WORD | nWkndNo, |
|
|
LPWORD | retVal ) |
Calculate the duration in calendar days of the long weekend that a given date falls on.
- 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
-
- Demo
WORD wDur=0;
nRetCode =
SFDB_WKNDur (lNextWknd, NULL, NULL, 0, wkndNo, &wDur);
std::wcout << L" SUCCESS - the duration SFDB_WKNDur for a given weekend: " << wDur << 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
- wknd_date.cpp.