Skip to main content
Participating Frequently
December 8, 2006
Question

datefield brings back wrong dates

  • December 8, 2006
  • 1 reply
  • 169 views
I have two datefield selectors in a flash form to create a report. The report works fine, only when I select a startdate for the report, the results are one day after the date selected. When I select the end date of the report it returns one day prior to the date selected.
Here is the code for the startdate datefield:
<cfinput type="datefield" name="startDate" label="Report Start Date" value="#LSDateFormat(form.startdate)#" width="100">

Here is the code for the enddate datefield:
<cfinput type="datefield" name="endDate" label="Report End Date" value="#LSDateFormat(form.enddate)#" width="100">

cfparam:
<cfparam name="form.startdate" default="">
<cfparam name="form.enddate" default="" >

Query:
<cfquery name="qGetattendance" datasource="mydsn">
SELECT students.firstname, students.lastname,
MIN(attendancedate) as startdate,
MAX(attendancedate) as enddate,
sum(fullday) AS AttendFullDay,
sum(halfday) as AttendHalfDay,
count(attendancedate) as dayCount,
sum(childrenbreakfast) as breakfastcount,
sum(childrenlunch) as lunchcount,
sum(children3pmsnack) as snackcount
FROM attendance, students
WHERE students.studentID = attendance.studentID and students.classroomID = 3 AND attendance.attendancedate > <cfqueryparam CFsqltype="CF_SQL_DATE" value="#form.startdate#"> and attendance.attendancedate < <cfqueryparam CFsqltype="CF_SQL_DATE" value="#form.enddate#">
GROUP BY students.lastname, students.firstname
ORDER BY lastname ASC</cfquery>

Any help is much appreciated.
Thank you.
Keann
    This topic has been closed for replies.

    1 reply

    keannAuthor
    Participating Frequently
    December 8, 2006
    nevermind....I figured out what I was missing. Sometimes CF makes a person feel really stupid!