Table of Contents
### 2.2. Datatypes

Entire Site

ColdFusion supports a number of datatypes for use in building expressions. These datatypes can be broken into two categories, simple and complex. The simple datatypes are made up of Booleans, strings, numbers (both integer and floating point), and date/time objects:

*Boolean*-
ColdFusion uses the Boolean datatype to store the value generated by a logical operation. Boolean values are stored as either

`TRUE`or`FALSE`. In numeric operations, Boolean values evaluate to`1`for`TRUE`and`0`for`FALSE`. When dealing with strings, Boolean values are set to`Yes`for`TRUE`and`No`for`FALSE`. Note that no quotes are necessary to delimit Boolean values. -
ColdFusion stores text values in strings delimited by a set of single or double quotes. For example,

`"This is a string."`and`'So is this!'`are both strings.`"1000"`and`'1000'`are also strings so long as the numbers are delimited by a set of quotes. The empty string can be written as either`''`or`""`. There are certain special characters that must be escaped within strings. These special characters are the single quote (`'`), double quote (`"`), and pound sign (`#`). These characters may be escaped by doubling up on them as in the following examples:<CFSET String1 = "This is a ""good"" use of escaped double quotes"> <CFSET String2 = "This is a ''good'' use of escaped single quotes"> <CFSET String3 = "What is the ##1 team in the league?">

As we'll discuss in the next section,

`<CFSET>`is a CFML tag you use to set a variable to a particular value. *Numbers*-
ColdFusion supports both floating-point (decimal) and integer (whole number) values. Numbers don't need to be delimited by quotes when referenced within expressions. The range for floating-point values in ColdFusion is ± 10

^{300}(1 followed by 300 zeros). The range for integer values is -2,147,483,648 to 2,147,483,647. ColdFusion automatically converts numbers outside this range to floating-point values.Most ColdFusion functions can perform calculations accurate to 12 decimal places. Numbers may be represented as either regular numbers or in scientific notation. ColdFusion formats numbers in scientific notation as

E*x*(*y**10*x*^{y}) whereis a positive real number in the range 1-10, and*x*is an integer. So, 100,000 equals 1.0E5 or 1*10*y*^{5}while .001 equals 1.0E-2 or 1*10^{-2}. *Date/time objects*-
ColdFusion allows you to specify date and time values separately or combined. Dates must range from 100 A.D. to 9999 A.D. and can be written as:

08/15/1998 1998-08-15 August 15, 1998 Aug 15, 1998 Aug. 15, 1998

ColdFusion handles two-digit years from 00 to 29 as 21st-century dates and two digit years from 30 to 99 as 20th-century dates.

^{[1]}^{[1]}If you are running ColdFusion on Unix and have Fast Date/Time Parsing enabled in the Server area of the ColdFusion Administrator, you must specify objects as month, day, and year. With the`DateFormat()`function, you must use a date mask that follows the required format (month, day, year) in order for ColdFusion to parse the date object.Times are accurate to the second and can be written as:

7pm 7:00pm 7:00pm 19:00:00

Combined date/time objects can be written as any combination of the previous dates and times.