User Guide

Table Of Contents
Strings 51
How ColdFusion stores dates and times
ColdFusion stores and manipulates dates and times as date-time objects. Date-time objects store
data on a time line as real numbers. This storage method increases processing efficiency and
directly mimics the method used by many popular database systems. In date-time objects, one
day is equal to the difference between two successive integers. The time portion of the date-and-
time value is stored in the fractional part of the real number. The value 0 represents 12:00 AM
12/30/1899.
Although you can use arithmetic operations to manipulate date-and-time values directly, this
method can result in code that is difficult to understand and maintain. Use the ColdFusion date-
time manipulation functions instead. For information on these functions, see the CFML
Reference.
Binary data type and binary encoding
Binary data (also referred to as a binary object) is raw data, such as the contents of a GIF file or an
executable program file. You do not normally use binary data directly, but you can use the
cffile
tag to read a binary file into a variable, typically for conversion to a string binary encoding before
transmitting the file using e-mail.
A string binary encoding represents a binary value in a string format that can be transmitted over
the web. ColdFusion MX supports three binary encoding formats:
ColdFusion provides the following functions that convert among string data, binary data, and
string encoded binary data:
Encoding Format
Base64 Encodes the binary data in the lowest six bits of each byte. It ensures that binary
data and non-ANSI character data can be transmitted using e-mail without
corruption. The Base64 algorithm is specified by IETF RFC 2045, at
www.ietf.org/rfc/rfc2045.txt.
Hex Uses two characters in the range 0-9 and A-F represent the hexadecimal value of
each byte; for example, 3A.
UU Uses the UNIX UUencode algorithm to convert the data.
Function Description
BinaryDecode Converts a string that contains encoded binary data to a binary object.
BinaryEncode Converts binary data to an encoded string.
CharsetDecode Converts a string to binary data in a specified character encoding.
CharsetEncode Converts a binary object to a string in a specified character encoding.
ToBase64
Converts string and binary data to Base64 encoded data Macromedia
recommends using the
BinaryEncode function, instead of this function, to convert
binary data to Base64 in new applications.