Dates and Native Database Drivers

Using native database drivers? Then you probably have already discovered that you cannot use the ODBC date functions (like CreateODBCDate() and CreateODBCDateTime()). To format dates for native database driver use you must use the DateFormat() and TimeFormat() functions to manually format the date as needed. (Applies to: ColdFusion 4 (or later))

One response to “Dates and Native Database Drivers”

  1. Petra Malherbe Avatar
    Petra Malherbe

    I have a problem with the dateformat function in CFMX6.1:
    How does the dateformat function decide what part of a date is the month and what part is the day?????
    We have 2 ColdFusion 5 Servers(a development and a production server). We want to switch our production Server to a new server that runs MX6.1. On both the current machines a date like 12/9/2003 will be passed to the next page as 12/9/2003 ( ie12 September 2003). We pass it with<input type=text> and in the receiving form we use #dateformat(form.pdate,"dd/mm/yyyy")# to display it. On the new Webserver, however, a date like 12/9/2003 is swopped to produce the date 9/12/2003 (ie 9 December 2003) when we use the dateformat function.This means that dates with a day part <=12 will be swopped to produce a "wrong" date. Is there a way to make the new Server handle the date the same way as our other Servers? (If we don’t find a way we will have to update 400 forms to use lsdateformat or add a date_hidden validate="eurodate" in each report where dates are used !!)
    The regional Settings for the account that ColdFusion uses to log on has been set to:
    Sdate= –
    sShortdate= dd/mm/yyyy
    The regional Settings for h_key users/.default/control Panel/international is set to the same values.

Leave a Reply