Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date type functions
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00562983
Message ID:
00563005
Views:
16
The following function will return date of any day of the week for specified date. It assumes that Sunday is the first day of the week.
Function DOWdate
Lparams dInDate, nDow
Return IIF(BETWEEN(nDOW,1,7), dInDate + (nDow - DOW(dInDate)), {})

? DOWdate( DATE(), 1)   && date for sunday
? DOWdate( DATE(), 7)   && date for saturday
>Hello All,
>
>I'm trying to figure dates to use in a select statement.
>
>The week() function returns the number of the week in the year.
>
>?week({^2001/10/14}) returns 42.
>
>I want to count back 8, 16, 24, 32 & 40 weeks from this date and then select records that fall between the first and last date of each of the above weeks.
>
>So, if 8 weeks back from 10/14/2001 is the week of 8/19/2001 to 8/25/2001, I want all records where the date_field is >= 8/19/2001 and date_field <= 8/25/2001.
>
>The same would go for weeks 16, 24, 32 & 40.
>
>I can store the start week to nweek and then subtract 8 to get nweekeight which equals 34 but I'm stuck on how you would find the first and last dates for week number 34.
>
>Any advice, help, pointers would be much appreciated.
>
>TIA,
>
>Jim Harvey
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform