date comparision

Results 1 to 2 of 2

Thread: date comparision

  1. #1
    anand nagarajan Guest

    Default date comparision

    i have a real probelm in my hands. i got a date field in my database and i want to compare the value in that field with a user inputted value. the question would be how to do that.if u can please mail me fast the result to<BR><BR>eg "31/02/99"

  2. #2
    Join Date
    Dec 1969

    Default When do you want comparison to happen?

    Do you want to compare *before* you get the records, so that you only get some of the records that match your comparison?<BR><BR>If so...<BR><BR>&#060;%<BR>userDate = "NO"<BR>On Error Resume Next<BR>userDate = CDate( Request("dateFieldFromForm") <BR>On Error GoTo 0<BR><BR>If userDate = "NO" Then<BR>&nbsp;&nbsp;&nbsp; Response.Write "You did not give a valid date!"<BR>&nbsp;&nbsp;&nbsp; Response.End<BR>End If<BR><BR>SQL = "SELECT * FROM someTable WHERE someDateField &#062; #" & userDate & "#"<BR><BR>Set RS = someConnectionYouMade.Execute( SQL )<BR>...<BR>%&#062;<BR><BR>You can use &#062;, &#060;, &#062;=, &#060;=, =, or &#060;&#062; in the comparison versus the database field.<BR><BR>The above code is for Access. If you are using *ANY* other database, replace each # character with a &#039 character.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts