Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Week() emulator in FPD 2x
Message
De
14/06/2001 13:28:52
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgie, États-Unis
 
 
À
14/06/2001 12:14:56
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00519474
Message ID:
00519527
Vues:
14
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform