|
| Iniciado por guest, 17,nov. 2015 11:48 - 10 respuestas |
| |
| | | |
|
| |
| Publicado el 17,noviembre 2015 - 11:48 |
Hello
Can someone please check the weeknumber for the date 04/01/2016
(thats uk date format 4th Jan 2016)
im using WD 18 and it outputs Week 1 but it should be week 2? Just want to check if its a bug i need to report or something to do with my settings?
Thanks
ISO |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 12:26 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 12:26 |
| Info (WeekNumber("20160104")) gives me also 1 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 12:27 |
| mayby because this is the complete begining of the first week |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 12:28 |
Hi ISO,
IMHO week 1 is correct (in the Netherlands, with Monday as the first day of the week). |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 12:35 |
Hello
but if you look at weeknumber 05/01/2015
5 jan 2015 which also the 1st monday of the year
this outputs week 2?
also if you select 02/01/2016 it outputs week 0?
Thanks
ISO |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 12:45 |
Hi,
I had this a long time ago with another date..
So i made a wordaround
PROCEDURE WeekNummer(pd_geldigedatum) ls_WeekDatum is string=Left(pd_geldigedatum, IF NOT DateValid(ls_WeekDatum) THEN RESULT 0 END IF WeekNumber(ls_WeekDatum)=0 THEN IF WeekNumber(datumplus(ls_WeekDatum,-7))=51 THEN RESULT 52 ELSE IF WeekNumber(datumplus(ls_WeekDatum,7))=1 THEN RESULT 53 END END
IF WeekNumber(ls_WeekDatum) > 52 THEN IF WeekNumber(datumplus(ls_WeekDatum,7)) <> 1 THEN RESULT 1 ELSE RESULT 53 END ELSE RESULT WeekNumber(ls_WeekDatum) END |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 13:33 |
| If you don't want to get week 0 use iso8601 in the WeekNumber function. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 13:49 |
I browsed this link:

and gives 1, so I guess it's correct.
HTH
King |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,noviembre 2015 - 17:10 |
Hi, this is the code to get the correct WeekNumber using the old French WeekNumber algo from WINDEV since WD 5.5 as a start. I've had months of disputes with our friends until they acknowledged that ISO 8601 is the French & in general the European norm for calculationg week numbers since 1997. It's been introduced as law then. The French algo has been in force since Napoleon I. who introduced week numbers first. And yes, the 4th of January, 2016 is in Week# 1 there's no way out!
MyWeek, MyYear are 4-byte int MyISOYearAndWeek is string
IF DateValid(MyDate) THEN // show corrected result of WeekNumber(Function) SWITCH WeekNumber(MyDate) CASE 0 // WeekNumber(Function) returns week #0 as a partial week with less than 4 days // in the beginning of a year. The week# should be propagated from the previous year MyWeek = WeekNumber(NumToString(Val(Left(MyDate,4)) - 1, "4d")+"1231") MyYear = Val(Left(MyDate,4))-1 CASE 53 // WeekNumber(Function) erroneously returns week #53 on partial weeks with // less than 4 days at the end of the year. Result should be week #1 IF DateToDay(Left(MyDate,4)+"1231") < 4 THEN MyWeek = 1 MyYear = Val(Left(MyDate,4))+1 ELSE // week #53 is correct because 4 or more days of the week are in that year MyWeek = 53 MyYear = Val(Left(MyDate,4)) END OTHER CASE // Results from WeekNumber(Function) <> 0 and <> 53 are generally OK MyWeek = WeekNumber(MyDate) MyYear = Val(Left(MyDate,4)) END MyISOYearAndWeek = NumToString(MyYear,"04d")+"-W"+NumToString(MyWeek,"02d") END |
| |
| |
| | | |
|
| | |
| |
| Publicado el 18,noviembre 2015 - 16:19 |
Hello
Thanks for your time people, i will use the 'iso8601' format
I guess 2015 because it has 4 days in the 1st week is counted as week 1 and 2016 only has 3 days so is counted as week 53.
ISO |
| |
| |
| | | |
|
| | | | |
| | |
|