Strings
59
When you do this, ColdFusion stores the information as a string. If you use a date-time function,
ColdFusion stores the value as a date-time object, which is a separate simple data type. When
possible, use date-time functions such as
CreateDate
and
CreateTime
to specify dates and times,
because these functions can prevent you from specifying the date or time in an invalid format and
they create a date-time object immediately.
Date and time formats
You can directly enter a date, time, or date and time, using standard U.S. date formats.
ColdFusion processes the two-digit-year values 0 to 29 as twenty-first century dates; it processes
the two-digit-year values 30 to 99 as twentieth century dates. Time values can include units down
to seconds. The following table lists valid date and time formats:
Locale-specific dates and times
ColdFusion provides several functions that let you input and output dates and times (and
numbers and currency values) in formats that are specific to the current locale. A
locale
identifies a
language and locality, such as English (US) or French (Swiss). Use these functions to input or
output dates and times in formats other than the U.S. standard formats. (Use the
SetLocale
function to specify the locale.) The following example shows how to do this:
<cfset oldlocale = SetLocale("French (Standard)")>
<cfoutput>#LSDateFormat(Now(), "ddd, dd mmmm, yyyy")#</cfoutput>
This example outputs a line like the following:
mar., 03 juin, 2003
For more information on international functions, see
Chapter 17, “Developing Globalized
Applications,” on page 371
and
CFML Reference
.
To specify
Use these formats
Date
October 30, 2003
Oct 30, 2003
Oct. 30, 2003
10/30/03
2003-10-30
10-30-2003
Time
02:34:12
2:34a
2:34am
02:34am
2am
Date and Time
Any combination of valid date and time formats, such as these:
October 30, 2003 02:34:12
Oct 30, 2003 2:34a
Oct. 30, 2001 2:34am
10/30/03 02:34am
2003-10-30 2am
10-30-2003 2am
Содержание COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Страница 1: ...Developing ColdFusion MX Applications...
Страница 22: ...22 Contents...
Страница 38: ......
Страница 52: ...52 Chapter 2 Elements of CFML...
Страница 162: ......
Страница 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Страница 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Страница 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Страница 266: ......
Страница 314: ...314 Chapter 14 Handling Errors...
Страница 344: ...344 Chapter 15 Using Persistent Data and Locking...
Страница 349: ...About user security 349...
Страница 357: ...Security scenarios 357...
Страница 370: ...370 Chapter 16 Securing Applications...
Страница 388: ...388 Chapter 17 Developing Globalized Applications...
Страница 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Страница 410: ......
Страница 426: ...426 Chapter 19 Introduction to Databases and SQL...
Страница 476: ...476 Chapter 22 Using Query of Queries...
Страница 534: ...534 Chapter 24 Building a Search Interface...
Страница 556: ...556 Chapter 25 Using Verity Search Expressions...
Страница 558: ......
Страница 582: ...582 Chapter 26 Retrieving and Formatting Data...
Страница 668: ......
Страница 734: ...734 Chapter 32 Using Web Services...
Страница 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Страница 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Страница 788: ......
Страница 806: ...806 Chapter 35 Sending and Receiving E Mail...