User Guide

Table Of Contents
Tags and functions for globalizing 415
Note: Many functions that have names starting with LS have corresponding functions that do not
have this prefix: DateFormat, IsDate, IsNumeric, NumberFormat, ParseDateTime, and
TimeFormat. These function use English (US) locale rules.
If you do not precede calls to the LS functions with a call to the SetLocale function, they use the
locale defined by the JVM, which typically is the locale of the operating system.
The following example uses the
LSDateFormat function to display the current date in the format
for each locale supported by ColdFusion MX:
<!--- This example shows LSDateFormat --->
<html>
<head>
<title>LSDateFormat Example</title>
</head>
<body>
<h3>LSDateFormat Example</h3>
<p>Format the date part of a date/time value using the locale convention.
<!--- loop through a list of locales; show date values for Now()--->
<cfloop list = "#Server.Coldfusion.SupportedLocales#"
index = "locale" delimiters = ",">
<cfset oldlocale = SetLocale(locale)>
<cfoutput><p><B><I>#locale#</I></B><br>
#LSDateFormat(Now(), "mmm-dd-yyyy")#<br>
#LSDateFormat(Now(), "mmmm d, yyyy")#<br>
#LSDateFormat(Now(), "mm/dd/yyyy")#<br>
#LSDateFormat(Now(), "d-mmm-yyyy")#<br>
#LSDateFormat(Now(), "ddd, mmmm dd, yyyy")#<br>
#LSDateFormat(Now(), "d/m/yy")#<br>
#LSDateFormat(Now())#<br>
<hr noshade>
</cfoutput>
</cfloop>
</body>
</html>
Additional globalization tags and functions
In addition to the tags and functions that are specifically for globalized applications, you might
find the following useful when writing a globalized application:
All string manipulation functions. For more information, see the String functions list in
Chapter 3, “ColdFusion Functions” in CFML Reference.
The GetTimeZoneInfo function, which returns the time zone of the operating system.
LSTimeFormat
Converts the time part of a date/time value into a string in a locale-
specific date format.
SetLocale
Specifies the locale setting.
Tag or function Use