Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Datetime Form + process.cfm

I have adopted a CF app running on CF 5.0 Pro ... I also have -0 experience with CFML ... but from what I gather that basics look relatively straight forward .. anyhow ... I would like to pass two dates (start date/time and end date/time) to a processing page but I am not sure where to start ... the process page already has the two variables set, and it executes correctly returning records for the last 24 hrs ... but I want to be able to say ... give me everything from Friday to Sunday ... or Sunday to Monday ... not just the last 24hrs .... any help? ideas?
0
af500
Asked:
af500
1 Solution
 
CFDevHeadCommented:
Why don't you post the code for both pages.  So we can better assist you.
0
 
PE_CF_DEVCommented:
the 2 vaiables on the second page that set the start and end time probably look something like this

<cfset starttime=datadd(hours,-24,now())>
<cfset endtime=now()>

(could have the wrong syntax I been doing T-SQL all day)

You'll want to change the <cfset to <cfparam name="starttime" default=datadd(hours,-24,now())>
What <cfparam does is if the variable is defined it leaves it alone if it is not it sets the variable to a default value.

In the other form you will simply want to send the start and end time via a form or in the URL or if it is an including file just set the start and end times. Make sure the variables are named the same. If you need more details let us know! Hope I didn't confuse you at all.
0
 
anandkpCommented:
change ur queries - i assume that shld do it ...

in ur query - u may have a where clause "where datefield < #dateadd('h',now(),-24)#

u'll need to change this to dates

like :

cfset date1 = #dateonfriday#
cfset date2 = #dateonsunday#

where datefield >= #date1# and datefield <= #date2#

let me know ...

K'Rgds
Anand
0
 
kjuliffCommented:
Are you asking how to PASS the two dates or how to make the query?

Others have answered the latter. To pass the 2 dates add them as parameters to your URL
eg URL="processit.cfm?date1=#date#&date2=#date2#"
If in a form just have the dates as hidden fields.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now