When you're inserting date/time values into a database, you want to be careful about deciding whether the date should be hardcoded into the form (perhaps as a hidden field) or whether it should be computed at the time of the data entry. These could each present very different date/time values.
One challenge when using CFINSERT is that you typically rely on the form to present all data for insert into the database, so you may feel restricted to hard-coding the date/time into the form.
In 4.01, this problem has been addressed. When using CFINSERT or CFUPDATE, you can define a form field with the name of a table column that will hold a date or time, and you can now store a special "value" for that field on the form: "currentdate()", or "currentdatetime()". Note that you do NOT wrap this in pound signs in the form. It's a special string value interpreted during the CFINSERT/CFUPDATE on the action page. And more important, the value is computed to be that at the time of the insert or update, which is usually what one intends.
This is documented only in the 4.0.1 documentation update page (not in the CFML reference for the tags). Also, the doc does not mention the currentdatetime() existing, but testing showed it to work as expected.
About Charlie Arehart A veteran ColdFusion developer since 1997, Charlie Arehart is a long-time contributor to the community and a recognized Adobe Community Expert. He's a certified Advanced CF Developer and Instructor for CF 4/5/6/7 and served as tech editor of CFDJ until 2003. Now an independent contractor (carehart.org) living in Alpharetta, GA, Charlie provides high-level troubleshooting/tuning assistance and training/mentoring for CF teams. He helps run the Online ColdFusion Meetup (coldfusionmeetup.com, an online CF user group), is a contributor to the CF8 WACK books by Ben Forta, and is frequently invited to speak at developer conferences and user groups worldwide.