Accessibility
 
Home > Products > ColdFusion > Support > Internationalization
ColdFusion Icon Macromedia ColdFusion Support Center - Internationalization
Changes to CFML localization formatting functions

This section explains changes in ColdFusion MX to the functions that you use to manage locale-related values. In ColdFusion MX, a function returns the same result on any operating system platform. In earlier versions, some functions returned different results depending on the platform.

The following table lists the changes to ColdFusion MX functions:

Function Change
ArraySort, ListSort

In ColdFusion MX, these functions sort elements in a slightly different order than they do in the ColdFusion 5 Japanese version. ColdFusion MX sorts characters by Unicode char number. (The ColdFusion 5 Japanese version sorts characters by shift_jis char number.) For more information, see Migrating ColdFusion 5 Applications.

LSDateFormat, LSTimeFormat

In ColdFusion MX, these functions support the mask attribute values short , medium , long , and full .

GetLocale

In ColdFusion MX, if the locale has not been set using the SetLocale function, this function returns the default locale of the client computer's operating system from the Java Virtual Machine (JVM). If the operating system has no set locale, or if ColdFusion MX does not support the operating system default locale, GetLocale returns en_US (English (US)). ColdFusion MX sets the locale in the JVM to en_US; this value persists until the server is restarted or the value is reset with the SetLocale function. The setting affects only ColdFusion MX.

In ColdFusion 5, in this situation, the function returns the value English(US).

LSCurrencyFormat

If this function is passed a negative number, it returns a negative number. It inserts a negative sign (-) to the left of the number. (In earlier versions, it enclosed the value in parentheses.)

This function correctly rounds currency values for currencies that do not include cents.

If the type argument = "local", the function returns a value in the locale's local currency format.

If the type argument = "international", the function returns a value in the locale's international format, with its international currency code.

LSCurrencyFormat, LSEuroCurrencyFormat

ColdFusion MX processes these functions as follows:

For all locales, LSCurrencyFormat returns the non-Euro currency format, regardless of whether the locale is a member of the Euro countries. For example, for the French(Standard) locale, LSCurrencyFormat returns the French franc currency symbol.

LSEuroCurrencyFormat returns the Euro currency format only if the set locale is a Euro member country. Otherwise, it returns the set locale's currency format or symbol.

ColdFusion 5, in this situation, returns the Euro currency format for every locale. For example, for the English(US) locale, LSEuroCurrencyFormat(123.45, "international") returns "EUR123.45".

LSDateFormat

If no mask is specified, ColdFusion MX returns the Java Medium date format for the locale. ColdFusion 5 returns one of the following default masks:

For a locale in which the date ends with the year, the default mask is dd-mmm-yy

For a locale in which the date begins with the year, the default mask is yyyy-mmm-dd

In ColdFusion MX, any date/time object is a valid input to the date parameter. In ColdFusion 5, only a date/time object in the range 100 AD-9999 AD is valid.

In ColdFusion MX, this function returns the appropriate date and format for the current locale. For example, LSDateFormat(12/01/02) returns the following:

For the English(UK) locale, Jan-12-2002

For the English(US) locale, Dec-01-2002

In ColdFusion 5, in this situation, this function throws an error or returns an incorrect date and format.

LSDateFormat, LSTimeFormat

In ColdFusion MX and ColdFusion 5, if you pass an invalid mask (for example, "dd-mm-yymm") to either of these functions, the function outputs the invalid characters. ColdFusion MX does not insert delimiters; ColdFusion 5 delimits each character with an apostrophe character.

LSTimeFormat

ColdFusion MX supports the following masks for this function:

h:m:s - lsTimeFormat("6:39","h:m:s") returns 6:39:0

hh:mm:ss - lsTimeFormat(6:39,"hh:mm:ss") returns 06:39:00

hh:mm:ss t - lsTimeFormat(6:28:26,"hh:mm:ss t") returns 06:28:26 A

hh:mm:ss tt - lsTimeFormat(6:28:26,"hh:mm:ss tt") returns 06:28:26 AM

LSIsCurrency

If a value formatted as Euro currency is passed to this function and the locale is a Euro member, ColdFusion MX returns "yes"; otherwise, "no".

LSIsDate

This function supports the Full date and date/time formats, which include the day name.

LSParseDateTime

In ColdFusion MX, in the English (US) locale, the following date mask format is obsolete:

23:15:16 4 Sept. 1998. Use a Java standard date format instead.

ColdFusion MX processes a time value in the date/time-string parameter as follows:

If the time zone value, such as "EST", is different from the time zone setting of the ColdFusion MX server computer, ColdFusion MX changes the time value in the parameter to its equivalent value in the computer's time zone.

If the time zone is not specified, ColdFusion MX does not adjust the time value.

In earlier versions, time zone values were not valid in the parameter.

Macromedia recommends that, when developing an application, you evaluate the date/time-string for a time zone value and, if necessary, change your application to adjust the value. To do this, you can use a cfcatch block; for more information, see LSParseDateTime and "CFCATCH variables" in CFML Reference.

In ColdFusion MX on the IBM Java Runtime Environment (JRE) version 1.3.0, this function fails if the month value "Janeiro" (for example, "Quarta-feira, 23 de Janeiro de 2002 12h34min56s PST"), is passed in the date/time-string parameter.

Date functions

ColdFusion MX processes a two-digit year value (a value that does not include the century digits) according to the Java standard, as follows. To determine the century value, it compares the value to the current date. If the value is within 80 years before and 20 years after the current date, it returns the value with the current century value prepended. Otherwise, it returns the previous century value. It uses 20 this way, as the "pivot point," except in the following locales: English(Australian), English(New Zealand), German(Austrian), German(Standard), German (Swiss), Portuguese(Brazilian), Portuguese(Standard), and Swedish. In these locales, ColdFusion MX uses 28.

Macromedia confirmed this inconsistency on the SUN JRE version 1.4 and the IBM JRE version 1.3.0. Macromedia also tested on the SUN JRE version 1.3.1_01; many of these tests failed on locales other than English(US). Results might differ depending on your JRE.

ColdFusion 5 uses 29 as the pivot point: if the date is within 71 years before and 29 years after the current date, it returns the current century value. Otherwise, it returns the previous century value.

This algorithm difference can cause incompatible results. For example, LSParseDateTime("25-12-13 22:10:15") returns the following year value:

1925, in ColdFusion MX

2025, in ColdFusion 5

For more information, see the Java documentation for the java.text.SimpleDateFormat class at http://java.sun.com/j2se/1.3/docs/api/index.html.


For more information on date-time value formats, see the LSParseDateTime function entry in CFML Reference and Developing ColdFusion MX Applications with CFML.

To Table of Contents Back to Previous document Forward to next document