Dates

Coldfusion dates are an interesting creature. In the database they are stored in a YYYY-MM-DD format. This is so that sorting makes sense. It obviously needs to sort first by year, then month, then day. If you sorted first by the month, you might end up with November of 2008 right along side November of 2009. Unfortunately, people here in America don’t write their dates like that. We speak by first listing the month, then the day, and we end with the year. So when getting people to enter date information into a custom programming form you don’t want to force them to act like a database and write in unusual ways. People will resist this change and cause trouble. That’s why Coldfusion has a built-in function called createODBCDate(), which converts the standard format that people enter into the database friendly format. This allows people to enter dates like MM/DD/YYYY and with a little function call, you can quickly change it to what you actually need. This makes sorting things sequentially by date a breeze once you have it in the database correctly. It may not be the most advanced programming trick, but it does provide an extremely useful function for programming that is probably needed and used very frequently. At DDA our programmers know that the user experience is very important so we make sure we do the little things like this to make everyone’s use as easy, understandable, and natural as possible.