Formats a date/time string in a locale-specific format. Does not parse POP date/time objects.
Date and time functions, Display and formatting functions, International functions, String functions
LSParseDateTime(date/time-string)
LSDateFormat,
ParseDateTime,
SetLocale
New in ColdFusion MX: This function might return different formatting than in earlier releases. This function uses Java standard locale formatting rules on all platforms.
New in ColdFusion MX: ColdFusion processes the date/time string
parameter value differently than in earlier releases:
date/time string
parameter is different from the time zone setting of the ColdFusion Server computer, ColdFusion adjusts the time value to its equivalent in the time zone of the ColdFusion Server computer.
date/time string
parameter, ColdFusion does not adjust the time value.
Macromedia recommends that, when developing an application, you evaluate the entered time string for a time zone setting; ensure that your application adjusts the value, if necessary. (To do this, you can use a cfcatch
tag.)
Parameter | Description |
---|---|
date/time-string |
A string a variable that contains one, in a format that is readable in the current locale. Default: English (US) locale. |
This function uses Java standard locale formatting rules on all platforms.
ColdFusion uses the following date/time string length formats:
You can pass a date/time value to this function that is in the English (US) locale, in any of the following date or date/time formats:
A date/time object is in the range 100 AD-9999 AD. See "How ColdFusion processes two-digit year values".
To set the default display format of date, time, number, and currency values, use the SetLocale function.
Note: This function does not accept POP dates.
<h3>LSParseDateTime Example - returns a locale-specific date/time object</h3> <!--- loop through a list of locales and 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> <p>Locale-specific formats: <br>#LSDateFormat(Now(), "mmm-dd-yyyy")# #LSTimeFormat(Now())#<br> #LSDateFormat(Now(), "mmmm d, yyyy")# #LSTimeFormat(Now())#<br> #LSDateFormat(Now(), "mm/dd/yyyy")# #LSTimeFormat(Now())#<br> #LSDateFormat(Now(), "d-mmm-yyyy")# #LSTimeFormat(Now())#<br> #LSDateFormat(Now(), "ddd, mmmm dd, yyyy")# #LSTimeFormat(Now())#<br> #LSDateFormat(Now(), "d/m/yy")# #LSTimeFormat(Now())#<br> #LSDateFormat(Now())# #LSTimeFormat(Now())#<br> <p>Standard Date/Time: #LSParseDateTime("#LSDateFormat(Now())# #LSTimeFormat(Now())#")#<br> </cfoutput> </cfloop>