Sottostante codice della pagina events.asp.
A questa pagina li si passa una data. events.asp?date=13/09/2005
Il problema dovrebbe essere quando si usa
dDate = CDate(Request.QueryString("Date"))
infatti se li passo la data 13/09/2005 me la trasforma in 9/13/2005 (formato america) --- OK mi va ad prendere la data giusta
se li passo 01/09/2005 me la trasforma in 1/9/2005 (formato america) ---- ERRORE infatti mi prende il 9 gennaio e non il 1 settembre.
ALTRA DOMANDA
Usando FormatDateTime(dDate, 1) mi viene poi la data in inglese come faccio ad averla in italiano?
<%
Response.Write (Request.QueryString("Date"))
If IsEmpty(Request.QueryString("Date")) OR NOT IsDate(Request.QueryString("Date")) Then
dDate = Date
' Response.Write dDate
Else
dDate = CDate(Request.QueryString("Date"))
' Response.Write dDate
------- CREDO CHE SIA QUI L'ERRORE --------
-------------------------------------------
--------------------------------------------------------
End If
%>
<HTML>
<HEAD>
<TITLE>Events for <%= FormatDateTime(dDate, 1) %></TITLE>
</HEAD>
<BODY BACKGROUND="images/image3.gif" LEFTMARGIN="5">
</P>
<P ALIGN=RIGHT>[img]images/events.gif[/img]</P>
<BR CLEAR=ALL>
<%
' Open a record set of schedules
Response.Write "<FONT COLOR='Gray' FACE='Tahoma, Verdana' SIZE=2>" & FormatDateTime(dDate, 1) & "</FONT>
" & vbCrLf
Set Rs = Server.CreateObject("ADODB.RecordSet")
sSQL = "SELECT * FROM tEvents " & _
"WHERE Start_Date <= #" & dDate & "# AND End_Date >= #" & dDate & "# ORDER BY Event_ID "
Rs.Open sSQL, sDSN, adOpenStatic, adLockReadOnly, adCmdText
If NOT Rs.EOF Then
arrColor =Array("#000000", "#CC9966", "#336600", "#003366", "#FFCC66", "#0000FF", "#FF0000")
iIndex = 0
Do While NOT Rs.EOF
' Create the outer table
Response.Write "<TABLE WIDTH='400' BORDER='0' CELLSPACING='0' CELLPADDING='1' BGCOLOR='" & arrColor(iIndex) & "'><TR><TD>" & vbCrLf
' Create the inner table
Response.Write "<TABLE WIDTH='100%' CELLSPACING=0 BORDER=0 CELLPADDING=2 BGCOLOR='White'>" & vbCrLf
Response.Write "<TR BGCOLOR='" & arrColor(iIndex) & "'><TD HEIGHT=20 WIDTH=220 VALIGN='top'><FONT FACE='Verdana, Tahoma' SIZE='1' COLOR='White'>" & vbCrLf
Response.Write Trim(Rs("Event_Title")) & VbCrLf
Response.Write "</FONT></TD>" & vbCrLf
If Session("Admin") = 1 Then
Response.Write "<TD WIDTH=90 HEIGHT=20 VALIGN='MIDDLE'>[img]images/edit.gif[/img]</TD>" & vbCrLf
Response.Write "<TD WIDTH=90 HEIGHT=20 VALIGN='MIDDLE'>[img]images/delete.gif[/img]</TD>" & vbCrLf
End If
Response.Write "</TR>" & vbCrLf
Response.Write "<TR><TD VALIGN='top' COLSPAN='3'>" & vbCrLf
' If the event lasts more than one day, indidate the start and end dates
If Rs("Start_Date") <> Rs("End_Date") Then
Response.Write "<FONT FACE='Verdana, Arial' SIZE=1 COLOR='Gray'>Starts: " & Rs("Start_Date") & vbCrLf
Response.Write "
Ends: " & Rs("End_Date") & vbCrLf
Response.Write "</FONT>
"
End If
' Print the event details
Response.Write "<FONT FACE='Verdana, Tahoma' SIZE='1' COLOR='Black'>" & vbCrLf
Response.Write Replace(Rs("Event_Details") & " ", vbCrLf, "
") & vbCrLf
Response.Write "</FONT></TD></TR>" & vbCrLf
Response.Write "</TABLE></TD></TR></TABLE>" & vbCrLf
Response.Write "
" & vbCrLf
Rs.MoveNext
iIndex = iIndex + 1
If iIndex = 3 Then
iIndex = 0
End If
Loop
End If
%>
</BODY>
</HTML>

Rispondi quotando