Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfset variables

Status
Not open for further replies.

sknyppy

Programmer
May 14, 1999
137
US
I have a form that accepts day, month, year as individual variables and I pass these to a cf template to <br>
insert into a database. In the processing form I want to do the following:<br>
<br>
&lt;cfset entry_date = month & '/' & day & '/' & year&gt;<br>
<br>
but errors arise and I'm stumped.<br>
<br>

 
This takes the current date and stores in to a variable. Maybe this will help.<br>
&lt;CFSET revision_date = DateFormat(&quot;#CreateODBCDate(Now())#&quot;, &quot;mm/dd/yyyy&quot;)&gt;<br>

 
rjs,<br>
<br>
That would work fine if I wanted the current date but I need the user to enter a date.<br>
<br>
Thanks<br>

 
It is the DateFormat() component that was the key element here. Are you using it? And what variable type (numeric, alpha) are the day, month and year components the user is entering?
 
If you are using month, day, and year as your variable names, the problem could be that these are CF functions. Try changing your variable names:<br>
<br>
&lt;cfset entry_date = mo & '/' & da & '/' & ye&gt; <p>Doug Trocino<br><a href=mailto:dtrocino@tecumsehgroup.com>dtrocino@tecumsehgroup.com</a><br><a href= Forums</a><br>Web Application Developer<br>
Tecumseh Group, Inc.<br>
Sponsors of Tek-Tips Forums<br>
 
I suggest that you use seperate names for month, day and year. Then, on the form action:<br>
<br>
&lt;cfset entry_date=&quot;#form.month#/#form.day#/#form.year#&quot;&gt;<br>
<br>
This should keep your data quality level consistant.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top