Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange result using Week()
Message
From
24/08/2005 10:54:27
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01043193
Message ID:
01043370
Views:
8
>Fabio,
>
>>I Agree, VFP is incorrect here, zero it is the correct choice.
>
>No, you are incorrect here. Every day must fall into some week depending on the chosen first day of the week. By your logic the 52nd WEEK() of the year would not always have 7 days.

All wrong.

Then who has not understood anything:
those of the VFPT or those of the SQLTeam?

Run next code on MSSQL;
week 1 have 1 day only !
declare @tt table (dd datetime)
declare @i int
select @i=1
while @i<20
begin
 insert into @tt values(cast('20041225' as datetime)+@i)
 select @i=@i+1
end
select dd,datename(ww,dd) from @tt
Run this on VFP;
The last week of 2004 is week 1!
CLEAR
dd={^2004/12/24}
FOR d=1 TO 20
  ? dd+d,WEEK(dd+d)
NEXT
It is evident that it is wrong VFP,
because if it is defined that a week Has to have 7 days,
then, the week can race on more years and then the week numeration has to be a sequence:
... 1,..... 53,54,.... 678,... 45666....

After all, the formal correctness of MSSQL is not absolute,
but it is not comparable with that of VFP (it doesn't have any global formal correctness)

Now, solve these problems:
1. GROUP BY WEEK( ) within a Year.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform