My DTBoxes tag will create the form elements on the page and Ken Beards
AssembleDT will create valid date/time objects on the following page:

http://www.tbcfug.org/index.cfm?fuseaction=files.details&file_id=29

> The most reliable way of capturing dates correctly on a form is to have 3
> select boxes, (day/month/year) with appropiate values in each one.
> 
> Then when the user submits use createdate(form.year,form.month,form.day) to
> create an unambiguous (is that a word) date stamp.
> 
> Its normally a good idea to put that in <cftry>/<cfcatch> to catch invalid
> dates entered (e.g. 30/02/01)
> 
> If you use createodbcdate() on that, then the data in db is correct.
> 
> You can then use dateformat() to display it how you want...
> 
> -----Original Message-----
> From: Will Swain [mailto:[EMAIL PROTECTED]]
> Sent: 20 April 2001 11:47
> To: CF-Talk
> Subject: FW: Dates suddenly formatting incorrectly.
> 
> 
> 
> Hi all,
> 
> Strange one this, it has me totally perplexed on this Friday morning.
> 
> I have several sites which have events pages. The site admin can upload
> details of new events, including their dates. This all worked fine until
> yesterday, when two of them started acting strangely, like so:
> 
> User inputs date: 26/05/01
> Date as shown in Access2000: 01/05/26
> 
> For some reason it seems to be swapping around the day and year. The date
> field is a short date.
> 
> This is the code for uploading the date:
> 
> <cfif IsDefined("Form.festdate")>
> 
>       <cfset festdate = #CreateODBCDate(Form.festdate)#>
> 
> </cfif>
> 
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> 
> <cfquery name="addfest" datasource="#datasourcename#">
> INSERT INTO tblfestticks (production, festdate, notes)
> VALUES (#Form.production#, #festdate#, '#Form.notes#');
> </cfquery>
> 
> So, I tried changing the date line to this:
> 
> <cfset festdate = #CreateODBCDate(#DateFormat("#Form.festdate#",
> "dd/mm/yy")#)#>
> 
> and the date 26/05/01 became 05/01/26!!
> 
> Now I'm really confused, and whilst I'm sure one of you guys will take one
> look at this and sort it out, I am completely stumped.
> 
> Regards,
> 
> Will Swain
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to