Forum de discussion
Forum « Programmation Javascript » (archives)
Re: Date
Envoyé: 10 octobre 2002, 10h58 par samlon
le code:
<%SQL="SELECT * FROM Indisponibility"
Set RS = server.createobject("ADODB.Recordset")
RS.Open SQL,Conn , 3, 3
%>
<%
Dim njTemp
Dim dateDebut
Dim dateFin
Dim dif
dateDebut = Rs("IndispoStartDate")
dateFin = Rs("IndispoFinishDate")
diff = DateDiff("m", dateDebut, dateFin)
For n = 1 to nbrCase
njTemp = n - nDateDebut+1
if nNomJour = 1 then response.write "<tr>"
if (njTemp) = nJour then
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""calJourSel"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
else if month(dateDebut) <> month(dateFin) OR year(dateDebut) <> year(dateFin) then
if year(dateFin) > year(dateDebut) then
if month(nDate) > month(dateDebut) AND year(nDate) = year(dateDebut) OR month(nDate) < month(dateFin) AND year(nDate) = year(dateFin) then
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""absence"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
else if (njTemp) >= day(dateDebut) AND (njTemp) <= day(nDate2) AND month(nDate) = month(dateDebut) AND year(nDate) = year(dateDebut) OR (njTemp) <= day(dateFin) AND (njTemp) >= day(nDate1) AND month(nDate) = month(dateFin) AND year(nDate) = year(dateFin) then
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""absence"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
else
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""calJour"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
end if
end if
else if diff >= 2 then
if month(nDate) > month(dateDebut) AND month(nDate) < month(dateFin) AND (njTemp) >= day(nDate1) AND njTemp <= day(nDate2) then
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""absence"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
else if (njTemp) >= day(dateDebut) AND (njTemp) <= day(nDate2) AND month(nDate) = month(dateDebut) AND year(nDate) = year(dateDebut) OR (njTemp) <= day(dateFin) AND (njTemp) >= day(nDate1) AND month(nDate) = month(dateFin) AND year(nDate) = year(dateDebut) then
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""absence"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
else
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""calJour"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
end if
end if
else if (njTemp) >= day(dateDebut) AND (njTemp) <= day(nDate2) AND month(nDate) = month(dateDebut) AND year(nDate) = year(dateDebut) OR (njTemp) <= day(dateFin) AND (njTemp) >= day(nDate1) AND month(nDate) = month(dateFin) AND year(nDate) = year(dateDebut) then
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""absence"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
else
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""calJour"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
end if
end if
end if
else if (njTemp) >= day(dateDebut) AND (njTemp) <= day(dateFin) AND month(ndate) = month(dateDebut) AND year(nDate) = year(dateDebut) then
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""absence"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
else
response.write "<a href="""&nURL&"?date="&DateSerial(nAnnee, nMois, njTemp)&"""><td align=""center"" valign=""middle"" class=""calJour"" style=""border: 1 solid #000000"" width=""110"" height=""45"">"
end if
end if
end if
if n < (nDateDebut) or n > (nJour2+nDateDebut-1) then
response.write " "
response.write "</td>"
if nNomJour = 7 then
response.write "</tr>"
end if
end if
if nNomJour = 7 then nNomJour = 1 else nNomJour = nNomJour + 1 end if
next
%>
</center>
<%Rs.Close
Set Rs = Nothing
Conn.Close
Set Conn = Nothing%>
Réponses
|