Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need function to find Monday by Week No
Message
 
 
To
24/09/2005 13:45:50
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01052733
Message ID:
01052741
Views:
8
>>Similar how VFP has function WEEK(), I need to find a reverse: Date (Monday) of the week by Week number (where Week Number is from 1 to 52).
>>I actually have a function like that but it is so long I am embarrassed to show it here (it consists of 19 lines) <g>.
>>
>>I was wondering if anybody can recommend a short and fast (speed is the most important) function to do this.
>>
>>Thank you in advance.
>
>Dmitry,
>
>It's not that hard to find the first monday of the year (date(year,1,1), find out the dow, and add a number depending on dow() to get to the first monday)
>
>From there, add 7 * (weeknumber - 1)

Gregory,

This is kind of what I was doing. But in my code, from finding the DOW of the first day of the year to the line of 7* (WeekNo-1) I have 8 lines of DO CASE where I determine the first Monday. I was hoping that there is a faster method.

Thank you very much.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform