![]() |
| Mysql date and time fields with Coldfusion |
|
darnold
|
I spent a lot of time troubleshooting the output of a cfquery from a mysql 5 date type and a time type field. I searched high and low to find an answer but found very little on the topic. The purpose of this post is to help anyone that might be having the same problem.
Problem: When selecting the date or the time my output looked like this for date
for time
When inserting a date or time an error occurs stating the data is not the correct format. Cause: The problem was coldfusion doesn't automatically convert the data into date or time format. The output is the actual odbc time format as read from the Coldfusion jdbc driver. Solution: Use DateFormat() to output and insert the date; use TimeFormat() to output or insert the time. to output
to insert
to output
to insert
note: mysql uses the 24 hour format. If you do not use hh:mm:ss all dates will be entered as AM. |
||||||||||||||||||||||
|
|
|||||||||||||||||||||||
|
Jason101
Forum Regular
|
When inserting/updating you can also use
To assure proper date/time conversion. |
||||||||||||||
|
|
|||||||||||||||
| Mysql date and time fields with Coldfusion |
|
||
|


