Print Page | Close Window

Show week number and ISO_8601

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=15685
Printed Date: 19 May 2024 at 10:56pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Show week number and ISO_8601
Posted By: zitz
Subject: Show week number and ISO_8601
Date Posted: 22 November 2009 at 4:39am
CXTPDatePickerControl wndDatePicker;
wndDatePicker.SetShowWeekNumbers( TRUE );

How to bring numbers of weeks to such a format?
http://en.wikipedia.org/wiki/ISO_8601 -
Quote ISO 8601 includes the http://en.wikipedia.org/wiki/ISO_week_date - ISO week date system, a numbering system for weeks – each week begins on a Monday and is associated with the year that contains that week's Thursday (so that if a year starts in a long weekend Friday–Sunday, week number one of the year will start after that). For example, week 1 of 2004 (2004W01) ran from Monday 29 December 2003 to Sunday, 4 January 2004, because its Thursday was 1 January 2004, whereas week 1 of 2005 (2005W01) ran from Monday 3 January 2005 to Sunday 9 January 2005, because its Thursday was 6 January 2005 and so the first Thursday of 2005. The highest week number in a year is either 52 or 53 (it was 53 for year 2004). http://en.wikipedia.org/wiki/ISO_8601 -


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



Replies:
Posted By: zeko78
Date Posted: 25 November 2009 at 4:22am
Hi Codejock,

It looks like the current version doesn't support ISO week numbers. This is the format that is used in most European countries.

Our customers has now stared noticing the datepicker showing "wrong" week numbers, and we need to provide a solution before January 1st.

Will Codejock be supporting ISO week numbering this year, or will the only solution be to replace your control?


Posted By: SuperMario
Date Posted: 25 November 2009 at 9:01am
It supports it.

The FirstWeekOfYearDays property contains the current required number of year days that occur in the first week of the year.

The FirstWeekOfYearDays property is needed because the first week of the year can be different depending on how many days occur in the first week.  For example, in Germany the first week of the year has to be a week with at least four days.  In the United States the first calendar week starts with January 1st.

            wndDatePicker.FirstWeekOfYearDays = 1
            wndDatePicker.FirstWeekOfYearDays = 4
            wndDatePicker.FirstWeekOfYearDays = 7

            wndDatePicker.FirstDayOfWeek = 4 ' Wednesday




Posted By: zitz
Date Posted: 25 November 2009 at 9:28am
Ok.
Please write, How to bring numbers of weeks to iso format.
I have to manually set FirstWeekOfYearDays for each year?
Or if i set
(wndDatePicker.FirstWeekOfYearDays = 4) my problem will be solved?

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


Posted By: SuperMario
Date Posted: 25 November 2009 at 12:01pm
It depends on your country.  If you are the same as Germany, then yes, you only need wndDatePicker.FirstWeekOfYearDays = 4


Posted By: zitz
Date Posted: 26 November 2009 at 2:08am
In Russia uses the ISO 8601 standard.
The first week of the year is week, that contains Thursday.
What FirstWeekOfYearDays number i must to set for Russia?


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


Posted By: zitz
Date Posted: 26 November 2009 at 2:35am
I can get LOCALE_IFIRSTWEEKOFYEAR from GetLocaleInfo
http://msdn.microsoft.com/en-us/library/dd373772%28VS.85%29.aspx
ValueMeaning
0Week containing 1/1 is the first week of the year. Note that this can be a single day, if 1/1 falls on the last day of the week.
1First full week following 1/1 is the first week of the year.
2First week containing at least four days is the first week of the year.

Please write corresponding FirstWeekOfYearDays values:
if
LOCALE_IFIRSTWEEKOFYEAR = 0 then FirstWeekOfYearDays=?
if LOCALE_IFIRSTWEEKOFYEAR = 1 then FirstWeekOfYearDays=?
if LOCALE_IFIRSTWEEKOFYEAR = 2 then FirstWeekOfYearDays=?


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


Posted By: zeko78
Date Posted: 01 December 2009 at 3:22am
Thanks.

Setting FirstWeekOfYearDays to 4 was just what I needed.



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