filtering for date in date field

Results 1 to 3 of 3

Thread: filtering for date in date field

  1. #1
    Join Date
    Dec 1969

    Default filtering for date in date field

    ive got a date filed in my database. sometimes it is date and time (mm/dd/yyyy hh:mm:ss AM) and sometimes it&#039;s just date (mm/dd/yyyy). once ive got my records into a record set, how can i do a rs.filter? using = won&#039;t work. and and using &#039;like&#039; with a wild card doesnt work with dates that have the time.<BR><BR>this works for records that are formatted mm/dd/yyyy, but not mm/dd/yyyy hh:mm:ss AM<BR><BR>dDate = "10/10/2004"<BR>rs.filter = "calendarDate like " & dDate & "%"<BR><BR>any help?<BR><BR>thanks,<BR><BR>corey

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default Choose ONE

    when you select the data, make sure they are all in ONE format<BR><BR>and why do you do a LIKE for a date??<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Choose ONE

    I agree with Akhilesh, you should really convert all to be just dates in building the recordset rather than mess around like this. like can&#039;t be used with datetime, so you would have to convert to varchar first, and then you would be worrying about formatting. If you really can&#039;t do the conversion inthe recordset build (and I don&#039;t see why not) then you could filter with something like this:<BR><BR>.rs.filter = "datetime_field &#062;= &#039;" & day1 & "&#039; AND datetime_field &#060; &#039; & nextday & "&#039;"

Posting Permissions

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