Print Page | Close Window

CXTPDatePickerControl and WeekNumbers

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=16469
Printed Date: 03 May 2024 at 2:13pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPDatePickerControl and WeekNumbers
Posted By: FSauer
Subject: CXTPDatePickerControl and WeekNumbers
Date Posted: 18 March 2010 at 8:47am
Hello @all,

i search for a possibility to set the right WeekNumbers and also a function to get the WeekNumber.

I'm using CXTPDatePickerControl and set CXTPDatePickerControl::SetShowWeekNumbers(TRUE);

My problem is, that 01.01.2010 is shown as Weeknumber 1 and it have to be Weeknumber 53.

By using CXTPDatePickerControl::SetFirstWeekOfYearDays(5); the date 01.01.2010 is shown as Weeknumber 52 and not 53 as expected.

For any help i'll be very glad.






Replies:
Posted By: zitz
Date Posted: 14 April 2010 at 9:41am
http://forum.codejock.com/forum_posts.asp?TID=15685
You need to set CXTPDatePickerControl::SetFirstWeekOfYearDays(4)

int CXXXUtils::GetFirstWeekOfYearDays()
{
    LCID lcLocalId = __lc_handle[ LC_TIME ];
    switch ( lcLocalId ) // Страны в которых действует ISO 8601
    {
    case 1036: // франция
    case 1049: // россия
    case 3082: case 1034:// испания
        return 4;
        break;
    }

    TCHAR szResult[ 5 ];
    int nResult = ::GetLocaleInfo( lcLocalId, LOCALE_IFIRSTWEEKOFYEAR , szResult, 4 );
    ASSERT( nResult == 2 );

    int iFirstWeekOfYearDays = _ttoi( szResult );
    if ( iFirstWeekOfYearDays == 2 )
    {
        return 4;
    }
    return 1;
}



-------------
Xtreme ToolkitPro v13.1.0, static, VC++6



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net