Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Week() emulator in FPD 2x
Message
From
14/06/2001 13:28:52
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgia, United States
 
 
To
14/06/2001 12:14:56
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00519474
Message ID:
00519527
Views:
13
This message has been marked as the solution to the initial question of the thread.
>Hi all,
>
>Does anyone have a VFP WEEK() function emulator in FPD 2.x so that I don't have to reinvent the wheel? Thanks in advance.

This will do the basic WEEK() function with the default settings. You can add the other parameters and recalulate nOffset if you like. That's why I used nOffset, I just never added the FirstDayofWeek parameter.
FUNCTION Week
*: Description: Returns the week number of dDate
*:              Assumes Sunday is First Day of the week
*:
*:  Parameters: dDate - A valid FoxPro date.
*:**********************************************
PARAMETER dDate
PRIVATE dJan1, nOffset, nRetVal
    dJan1 = CTOD("01/01/"+ALLTRIM(STR(YEAR(dDate))))
    nOffset = DOW(dJan1)
    nRetVal = CEILING((nOffSet + (dDate - dJan1))/7)
Return nRetVal
David.
Previous
Reply
Map
View

Click here to load this message in the networking platform