Depends on how your OS is set up for dates, ie US dates or whatever. By the way, this isn't a mySQL issue, it is an OS level issue.
US dates are month/day/year which is why it is not doing what you are expecting it to do If you want a quick fix, convert the month to a string <cfset dateArray= listToArray(form.datelisted, "/") /> <cfset dateArray[2] = monthAsString(dateArray[2]) /> <cfset dateValue = arrayToList(dateArray, "-") /> >From here you can use your date as you need it because the parser will see the month string and treat it as such and put it in the right place Steve -----Original Message----- From: Gavin Baumanis [mailto:[email protected]] Sent: Wednesday, 20 July 2011 12:05 AM To: cfaussie Subject: [cfaussie] MySQL - date insertion issues. Hi Everyone, I have the following code; form.date : #form.datelisted#<br /> LSDATEFORMAT : #lsdateformat(form.datelisted, 'YYYY-MM-DD')#<br /> DATEFORMAT : #dateformat(form.datelisted, 'YYYY-MM-DD')#<br /> CREATEODBCDATE : #createodbcdate(form.datelisted)#<br /> CREATEODBCDATETIME : #createodbcdatetime(form.datelisted)#<br /> Which outputs the following; form.date : 01/03/2011 LSDATEFORMAT : 2011-01-03 DATEFORMAT : 2011-01-03 CREATEODBCDATE : {d '2011-01-03'} CREATEODBCDATETIME : {ts '2011-01-03 00:00:00'} My question is why are my month and day parts of my date being transposed? How do I stop it from being so? The date that should be inserted into the database is the 1st of March, not 3rd January. As always - Thanks! Gavin. -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en. -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
