HeaderPane
Main
Hide
Share Link
Print

WeekNumberRule

Defines how week numbers are computed.

C

int WINAPI SftDate_GetWeekNumberRule(HWND hwndCtl);
BOOL WINAPI SftDate_SetWeekNumberRule(HWND hwndCtl, int rule);

C++

int CSftDate::GetWeekNumberRule() const;
int CSftCalendar::GetWeekNumberRule() const;
BOOL CSftDate::SetWeekNumberRule(int rule);
BOOL CSftCalendar::SetWeekNumberRule(int rule);

Parameters

hwndCtl

The window handle of the month calendar control (SftCalendar), or of the date field control (SftDate) whose dropdown calendar is affected.

rule

Defines the week number rule. rule can be one of the following values:

SFTDATE_WEEKRULE_CULTUREThe rule of the culture (SetCulture): its first week of the year and the first day of the week (SetFirstDayOfWeek). This is the default.
SFTDATE_WEEKRULE_ISO8601ISO 8601: weeks start on Monday and week 1 is the week with the year's first Thursday.

Returns

GetWeekNumberRule returns the rule, one of the values listed above.

SetWeekNumberRule returns TRUE if the value is valid, otherwise FALSE.

Comments

The GetWeekNumberRule and SetWeekNumberRule functions define and retrieve how the week numbers shown using SetShowWeekNumbers are computed.

The setting applies to a month calendar control and to the dropdown calendar of a date field control.

Examples

C View entire sample code

        SftDate_SetMonthsAcross(hwndCal, sel + 1);
        break;
    case IDC_DOWN:
        SftDate_SetMonthsDown(hwndCal, sel + 1);
        break;
    case IDC_WEEKNUMBERS:
        for (i = 0; i < CONTROLS; ++i) {
            SftDate_SetShowWeekNumbers(c[i], sel > 0);
            SftDate_SetWeekNumberRule(c[i], sel == 2 ? SFTDATE_WEEKRULE_ISO8601 : SFTDATE_WEEKRULE_CULTURE);
        }
        break;
    case IDC_FIRSTDAY:
        for (i = 0; i < CONTROLS; ++i)
            SftDate_SetFirstDayOfWeek(c[i], sel);
        break;
    case IDC_VIEWS:

C++ View entire sample code

        m_Calendar.SetMonthsAcross(sel + 1);
        break;
    case IDC_DOWN:
        m_Calendar.SetMonthsDown(sel + 1);
        break;
    case IDC_WEEKNUMBERS:
        for (int i = 0; i < CONTROLS; ++i) {
            Control(i).SetShowWeekNumbers(sel > 0);
            Control(i).SetWeekNumberRule(sel == 2 ? SFTDATE_WEEKRULE_ISO8601 : SFTDATE_WEEKRULE_CULTURE);
        }
        break;
    case IDC_FIRSTDAY:
        for (int i = 0; i < CONTROLS; ++i)
            Control(i).SetFirstDayOfWeek(sel);
        break;
    case IDC_VIEWS:

See Also C/C++ API | Categories | Notifications


Last Updated 11/26/2026 - (email)
© 2026 Softel vdm, Inc.