Skip to main content
October 20, 2008
Answered

update dates

  • October 20, 2008
  • 4 replies
  • 665 views
I am trying to update an Access database table that includes a date/time column labeled "StartDate". When I insert the date, it is inserted properly. When I come back to update the date, the date that is entered is different int the database from what I entered. It is sometimes years off. I have tried to format the date in the form but I still get the error. I even tried to hard enter it without varriables and I still have the issue. I am using a simple CFUPDATE as well on the processing page. Here is the form element:

<cfinput type="text"
name="StartDate"
required="yes"
message="Start Date is needed"
value="#VARIABLES.StartDate#"
validate="USDate"
size="5"
maxlength="10">

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
Thanks. I have changed my update to cfquery.

4 replies

Inspiring
October 20, 2008
So you see 10-12-08. Was that what was in your text box?

Your bigger issues are probably a result of using one of the most ambiguous date format available. I'm guessing your record gets updated to Dec 12, 2010.

Solutions.
1. Don't blindly accept the form string as a date. Use createdate to turn it into a real date object.
2. Use cfquery instead of cfupdate. My understanding is that cfupdate only works with form variables.
Correct answer
October 21, 2008
Thanks. I have changed my update to cfquery.
Inspiring
October 20, 2008
<cfdump var="#form#">
<cfabort>

gets you started on your action page.
October 20, 2008
Thanks Dan. You have always been a great help. I did as you said and I am getting an output of:
'10-12-08
Could my issues becoming from this apostrophe? If so how do I get rid of it?