Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

update dates

Guest
Oct 20, 2008 Oct 20, 2008
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">

TOPICS
Database access
664
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Oct 21, 2008 Oct 21, 2008
Thanks. I have changed my update to cfquery.
Translate
LEGEND ,
Oct 20, 2008 Oct 20, 2008
<cfdump var="#form#">
<cfabort>

gets you started on your action page.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 20, 2008 Oct 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2008 Oct 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 21, 2008 Oct 21, 2008
LATEST
Thanks. I have changed my update to cfquery.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources