Comparing dates and FoxPro6.1

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Comparing dates and FoxPro6.1

    Is it my imagination or does this time out quicker?

    I am building a query that would retrieve specific documents from a FoxPro 6.1
    table(*.dbf) I am selecting columns (fields) from two different, but related
    tables. There are two different criteria to use in retrieving the documents: by
    empid (specific employee) or date (date the document was created) The default
    is all dates and all employees. There's no problem using empid in the WHERE
    clause - either with dates or without dates. The problem is with dates - I
    cannot get the dates specified in a range, or individual date. I can specify
    the date criteria (select single date radio button and input the date in
    mm/dd/yyyy format into a <CFINPUT type = "text" VALIDATE="date"> or date range
    radio button and enter a start_date and end_date in the same kind of CFINPUT.

    What I found is if the unformatted date is printed out from the FoxPro field
    in CFOUTPUT, it has this format:
    {ts '2001-08-27 00:00:00'}. Printing out the textbox fields validated as dates
    unformatted gives: 04/12/2001.

    Using CreateODBCDate() on the form field dates gives a format something like
    {d '2001-04-12'} which doesn't seem like it would compare to the other
    format,and it doesn't.

    Using WHERE Date BETWEEN #Start_date# AND #EndDate# does not work. The date in
    the FoxPro field in BROWSE looks like 04/12/01, and clicking on an individual
    date cell in the table, it goes 04/12/2001.

    What I did was use DatePart() on the form fields, and passed them into a
    CreateDate() function and stored the results into variables called beginning
    and ending. They print out unformated like this:
    Beginning = {ts '2001-04-12 00:00:00'} and Ending = {ts '2001-12-20 00:00:00'}
    and my SQL becomes WHERE Date BETWEEN #Beginning# AND #Ending# and that seems
    to be the same way FoxPro date is represented - BUT IT DOESN'T WORK!!! The
    dates printed above are the dates entered, and the one from the database
    (printed above) was the date of a document retrieved from the dataabse which
    was 1 amongst a total list of 780 with dates from 1996 to 2004. I would expect
    the few dozen dates that meet the date criteria would be listed.

    I've done about everythnig I can think of such as using DateFormat() with
    "mm/dd/yyyy" mask on the form fields. I suppose I could try WHERE Date BETWEN
    "{ts '#DateFormat(Start_date,"YYYY-MM-DD")# 00:00:00'}" AND ..., but why should
    that be any different than #Beginning# (unless I didn't specify character
    concatenation correctly)

    Is there another approach to this other than what I wrote above that might
    work? Putting quotes around the dates such as "#Beginning#" also doesn't work.
    There are no error messages, everything functions like it is supposed to the
    only thing is the date comparison in the WHERE clause appears to be ignored.


    Johnny Jevidetti Guest

  2. Similar Questions and Discussions

    1. comparing Dates
      Hi all, I'm building a sort of calendersystem with the ability for users to make reservations for meetingrooms. All reservations are stored in...
    2. comparing two strings
      Hi, I'm trying to query a table to tell if a username exists within it, but I can't seem to compare the two strings and get it to work. Any...
    3. Comparing Time
      I am trying to query a DB for all records that were created by one user, on one day and between two time periods. Here is my codet: <cfset...
    4. Comparing file dates with current date
      I am trying to compare a file's modified timestamp with the current date. I can use 'stat' to get the timestamp of the file but am not sure how...
    5. Comparing Dates using Javascript
      You could use jscript in ASP. Take a look at the date object in your jscript documentation that you've already downloaded or view it online at...
  3. #2

    Default Re: Comparing dates and FoxPro6.1

    I can reply to my own topic? Here goes: please NEVER MIND my previous posting. I GOT THE THING TO WORK!!!! Everythnig is A-OK now! No need to reply
    Johnny Jevidetti Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139