Trouver les date de debut et de fin a partir d'un numero de semaine

Signaler
Messages postés
12
Date d'inscription
mardi 8 février 2005
Statut
Membre
Dernière intervention
20 mai 2005
-
Messages postés
2
Date d'inscription
mardi 3 juin 2003
Statut
Membre
Dernière intervention
1 juin 2006
-
salut,

j'ai un probleme je n'arrive pas a trouver les date de debut et de fin d'un semaine a partir du numero de cette semaine ainsi que de l'annee.

qq'un a un solution ??

SVP c urgent.

5 réponses

Messages postés
586
Date d'inscription
lundi 7 janvier 2002
Statut
Membre
Dernière intervention
10 février 2010
1
asp ou asp.net ?

yopyop
Messages postés
12
Date d'inscription
mardi 8 février 2005
Statut
Membre
Dernière intervention
20 mai 2005

en ASP
Messages postés
586
Date d'inscription
lundi 7 janvier 2002
Statut
Membre
Dernière intervention
10 février 2010
1
Function GetWorkWeekDisplay(dtmDate)
intDay = DatePart("w",dtmDate)
If intDay < 2 Then
dtmMonday = DateAdd("d",1,dtmDate)
dtmFriday = DateAdd("d",5,dtmDate)
Elseif intDay = 2 Then
dtmMonday = DateAdd("d",0,dtmDate)
dtmFriday = DateAdd("d",4,dtmDate)
Elseif intDay = 3 Then
dtmMonday = DateAdd("d",-1,dtmDate)
dtmFriday = DateAdd("d",3,dtmDate)
Elseif intDay = 4 Then
dtmMonday = DateAdd("d",-2,dtmDate)
dtmFriday = DateAdd("d",2,dtmDate)
Elseif intDay = 5 Then
dtmMonday = DateAdd("d",-3,dtmDate)
dtmFriday = DateAdd("d",1,dtmDate)
Elseif intDay = 6 Then
dtmMonday = DateAdd("d",-4,dtmDate)
dtmFriday = DateAdd("d",0,dtmDate)
Elseif intDay = 7 Then
dtmMonday = DateAdd("d",-5,dtmDate)
dtmFriday = DateAdd("d",-1,dtmDate)
End If
GetworkweekDisplay = dtmMonday & " thru " & dtmFriday
End Function
response.write "" & GetworkweekDisplay(Date) & ""

teste bien les débuts d'année....

yopyop
Messages postés
12
Date d'inscription
mardi 8 février 2005
Statut
Membre
Dernière intervention
20 mai 2005

oki merci pour ta reponse
Messages postés
2
Date d'inscription
mardi 3 juin 2003
Statut
Membre
Dernière intervention
1 juin 2006

Bonjour,


Merci pour ce script. Je l'ai adapté à mes besoins qui étaient d'avoir la date de tous les jours avec un numero de semaine égal à numero de semaine en cours + 1 :

Function GetWorkWeekDisplay(dtmDate,jour)
intDay = DatePart("w",dtmDate)
If intDay < 2 Then
dtmMonday = DateAdd("d",1,dtmDate)
dtmTuesday = DateAdd("d",2,dtmDate)
dtmWednesday = DateAdd("d",3,dtmDate)
dtmThursday = DateAdd("d",4,dtmDate)
dtmFriday = DateAdd("d",5,dtmDate)
dtmSaturday = DateAdd("d",6,dtmDate)
dtmSunday = DateAdd("d",7,dtmDate)
Elseif intDay = 2 Then
dtmMonday = DateAdd("d",0,dtmDate)
dtmTuesday = DateAdd("d",1,dtmDate)
dtmWednesday = DateAdd("d",2,dtmDate)
dtmThursday = DateAdd("d",3,dtmDate)
dtmFriday = DateAdd("d",4,dtmDate)
dtmSaturday = DateAdd("d",5,dtmDate)
dtmSunday = DateAdd("d",6,dtmDate)
Elseif intDay = 3 Then
dtmMonday = DateAdd("d",-1,dtmDate)
dtmTuesday = DateAdd("d",0,dtmDate)
dtmWednesday = DateAdd("d",1,dtmDate)
dtmThursday = DateAdd("d",2,dtmDate)
dtmFriday = DateAdd("d",3,dtmDate)
dtmSaturday = DateAdd("d",4,dtmDate)
dtmSunday = DateAdd("d",5,dtmDate)
Elseif intDay = 4 Then
dtmMonday = DateAdd("d",-2,dtmDate)
dtmTuesday = DateAdd("d",-1,dtmDate)
dtmWednesday = DateAdd("d",0,dtmDate)
dtmThursday = DateAdd("d",1,dtmDate)
dtmFriday = DateAdd("d",2,dtmDate)
dtmSaturday = DateAdd("d",3,dtmDate)
dtmSunday = DateAdd("d",4,dtmDate)
Elseif intDay = 5 Then
dtmMonday = DateAdd("d",-3,dtmDate)
dtmTuesday = DateAdd("d",-2,dtmDate)
dtmWednesday = DateAdd("d",-1,dtmDate)
dtmThursday = DateAdd("d",0,dtmDate)
dtmFriday = DateAdd("d",1,dtmDate)
dtmSaturday = DateAdd("d",2,dtmDate)
dtmSunday = DateAdd("d",3,dtmDate)
Elseif intDay = 6 Then
dtmMonday = DateAdd("d",-4,dtmDate)
dtmTuesday = DateAdd("d",-3,dtmDate)
dtmWednesday = DateAdd("d",-2,dtmDate)
dtmThursday = DateAdd("d",-1,dtmDate)
dtmFriday = DateAdd("d",0,dtmDate)
dtmSaturday = DateAdd("d",1,dtmDate)
dtmSunday = DateAdd("d",2,dtmDate)
Elseif intDay = 7 Then
dtmMonday = DateAdd("d",-5,dtmDate)
dtmTuesday = DateAdd("d",-4,dtmDate)
dtmWednesday = DateAdd("d",-3,dtmDate)
dtmThursday = DateAdd("d",-2,dtmDate)
dtmFriday = DateAdd("d",-1,dtmDate)
dtmSaturday = DateAdd("d",0,dtmDate)
dtmSunday = DateAdd("d",1,dtmDate)
End If if jour 0 then GetworkweekDisplay dtmSunday if jour 1 then GetworkweekDisplay dtmMonday if jour 2 then GetworkweekDisplay dtmTuesday if jour 3 then GetworkweekDisplay dtmWednesday if jour 4 then GetworkweekDisplay dtmThursday if jour 5 then GetworkweekDisplay dtmFriday if jour 6 then GetworkweekDisplay dtmSaturday
End Function

for i=1 to 7
Select Case i
Case 1
jour = "Lundi " & GetworkweekDisplay((Date+7),1)
Case 2
jour = "Mardi " & GetworkweekDisplay((Date+7),2)
Case 3
jour = "Mercredi " & GetworkweekDisplay((Date+7),3)
Case 4
jour = "Jeudi " & GetworkweekDisplay((Date+7),4)
Case 5
jour = "Vendredi " & GetworkweekDisplay((Date+7),5)
Case 6
jour = "Samedi " & GetworkweekDisplay((Date+7),6)
Case 7
jour = "Dimanche " & GetworkweekDisplay((Date+7),0)
End Select