Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Found Week Number from given date
Message
From
28/07/2021 04:23:05
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
 
To
28/07/2021 00:50:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01681946
Message ID:
01681952
Views:
47
Hi Luis,

the week number may be different from country to country, since the definition may vary. In Norway December 31st 2019 belongs to week no. 1 in 2020. If you wonder why, I suggest that you ask Google.

I see no reason to NOT use Week() since it should always give the right answer. The second parameter lets you select the correct rule in your country.

>Hello comunity,
>
>I found this function for returning Week number from given Date, but failed on certain year !?
>
>
>
>?getweekno(DATE(2019,12,31))
>Return = 1
>
>FUNCTION GetWeekNo
> LPARAMETERS ldDate
> lnJulian = VAL(SYS(11,ldDate))+1
> lnDay4 = MOD(MOD(MOD((lnJulian+31741 - MOD(lnJulian,7)),146097),36524),1461)
> lnLeap = INT(lnDay4/1460)
> lnDay1 = MOD(lnDay4-lnLeap,365) + lnLeap
> RETURN INT(lnDay1/7)+1
>ENDFUNC
>
>
>the same work great for 31.12.2021, 31.12.2020, but for 31.12.2019 they return : 1
>also, i use :
>
>
>?WEEK(DATE(2019,12,31),2,2)
>Result = 1
>
>
>Why ?
>
>Many Thanks,
>Best regards,
>Luis

Hi Tore,

Thanks for your reply, i will go to search more information on google.

Best regards,
Luis
Previous
Reply
Map
View

Click here to load this message in the networking platform