Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Between Dates

    I am trying to query an online access database and return records that have
    occurred between dates. I am using another query which does work to produce the
    start and finish dates.
    <cfif isdefined ("form.Period")>
    <cfquery name="PayPeriodSelect"
    datasource="#Request.MainDSN#">
    SELECT *
    From
    OilEmployeeTime
    Where
    (Finish Between ##PayPeriod.Start## And ##PayPeriod.Finish##);
    </cfquery>
    <cfdump var="#PayPeriodSelect#">
    <cfdump var="#form.period#">
    </cfif>
    Does anyone have any ideas where i am going wrong. Thanks

    javman Guest

  2. Similar Questions and Discussions

    1. Dates & SQL
      In my CF form I have created a date object using #DateFormat(Now(),"MM/DD/YY")# which displays the date as: 07/29/05. When the date is inserted...
    2. ASP/VBS Dates Between Dates
      I'm trying to filter records depending on 2 dates requested from the querystring MMColParam1 (startdate) and MMColParam2 (enddate), i.e. a list...
    3. Dates again
      Hello all I'm having trouble getting iis to understand the UK format of dates ASP off a MS Access database I have the following query:...
    4. Dates
      Thanks to all those who replied. I ended up doing some research myself and found a good date module at...
    5. Help with Dates please
      Hi, In a SQL table I have a field named departure and a date in inserted in it. What is the exact syntax to get only records with a future date...
  3. #2

    Default Re: Between Dates

    Can you clarify exactly what the problem you are having is?
    TA-Selene Guest

  4. #3

    Default Re: Between Dates

    I have sort of got the date function to work.
    I was using a result from another query in by date query which did not work
    since I was working with a 14 day pay period I changed the query to use a form
    variable.
    <cfif isdefined ("form.Start")>
    <cfquery name="PayPeriodSelect"
    datasource="#Request.MainDSN#">
    SELECT *
    From
    OilEmployeeTime
    Where
    Area Like '#Request.Area#' And (Start > #DateFormat(form.start,
    "mm/dd/yyyy")#)<!--- And (Finish < #DateFormat((form.start+14),
    "mm/dd/yyyy")#)--->;
    </cfquery>
    <cfdump var="#PayPeriodSelect#">
    <cfdump var="#form.Start#">
    </cfif>

    This works but it does not allow the second part of the sql. When I use that i
    get a syntax error

    javman Guest

  5. #4

    Default Re: Between Dates

    Use #CreateODBCDate(form.start)# to pass your dates to the DB
    OldCFer Guest

  6. #5

    Default BETWEEN DATES

    I have been using a piece of code in a query that works fine with Access but
    not with mysql. i need to show all the records that fall between NOW() and the
    next three days.

    Could anyone help with the code necessary to get the same to work with mySQL.

    Thanks

    WHERE tblMatches.betend BETWEEN NOW() AND NOW() +3

    pwizzard Guest

  7. #6

    Default Re: BETWEEN DATES

    Perfect, thanks very much.
    pwizzard 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