Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining the start and end dates of a given week
Message
De
08/12/2003 10:05:21
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00856775
Message ID:
00856814
Vues:
19
Hi Rhodri, thanks for replying!

Sorry, think I couldn't express myself correctly. When I asked:

"How can I determine the dates of the first and the last days in a week, given the week number, the year and the month where it occurs?"

I wanted to mean that, having a specific week, identified by its number (please see Week() function), like 1, 2,..., 52, and knowing in what month it falled (say week number 50 of december, 2003) what dates corresponded to the first (sunday) and last (saturday) days of that specific week.

In that case I would have, for example, two functions with 3 parameters like:
dStartDate = FirstDateOfWeek (nWeekNumber, nYear, nMonth)

and 

dEndDate   = LastDateOfWeek  (nWeekNumber, nYear, nMonth)
Hope now I was more clear <s>

Regards,

Fernando


>This can be achieved fairly easily using VFP's DOW() function
>
>?Date()-Dow(Date())+1 && beginning of this week
>?Date()+7-Dow(Date()) && end of this week
>
>Function StartWeek
>Lparameters tdDate
>Return tdDate - Dow(tdDate) + 1
>
>Function EndWeek
>Lparameters tdDate
>Return tdDate + 7 - Dow(tdDate)
>
>Rhodri
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform