User Guide

Table Of Contents
60 Chapter 3: Using ColdFusion Variables
ColdFusion cannot convert complex types, such as arrays, queries, and COM objects, to other
types. However, it can convert simple data elements of complex types to other simple data types.
Type conversion considerations
The following sections detail specific rules and considerations for converting between types.
The cfoutput tag
The cfoutput tag always displays data as a string. As a result, when you display a variable using
the
cfoutput tag, ColdFusion applies the type conversion rules to any non-string data before
displaying it. For example, the
cfoutput tag displays a date-time value as an ODBC timestamp.
Case-insensitivity and Boolean conversion
Because ColdFusion expression evaluation is not case-sensitive, Yes, YES, and yes are equivalent;
False, FALSE, and false are equivalent; No, NO, and no are equivalent; and True, TRUE, and
true are equivalent.
Converting binary data
ColdFusion cannot automatically convert binary data to other data types. To convert binary data,
use the
ToBase64 and ToString functions. For more information, see “Binary data type and
binary encoding” on page 51.
False False 0 Error "No"
Number True if Number
is not 0; False
otherwise.
Number See “Date-time values
earlier in this chapter.
String representation
of the number (for
example, “8”).
String If "Yes", True
If "No", False
If it can be
converted to 0,
False
If it can be
converted to
any other
number, True
If it represents a
number (for
example, "1,000"
or "12.36E-12"), it
is converted to the
corresponding
number. If it
represents a date-
time (see next
column), it is
converted to the
numeric value of
the corresponding
date-time object.
If it is an ODBC date, time,
or timestamp (for example
"{ts '2001-06-14
11:30:13'}", or if it is
expressed in a standard
U.S. date or time format,
including the use of full or
abbreviated month names,
it is converted to the
corresponding date-time
value.
Days of the week or
unusual punctuation result
in an error.
Dashes, forward-slashes,
and spaces are generally
allowed.
String
Date Error The numeric value
of the date-time
object.
Date An ODBC timestamp.
Value As Boolean As number As date-time As string