Formats the date portion of a date/time value using the locale convention. Like DateFormat
, LSDateFormat
returns a formatted date/time value. If no mask is specified, LSDateFormat
returns a date value using the locale-specific format.
LSDateFormat(date [, mask ])
When passing date/time value as a string, enclose it in quotes. Otherwise, it is interpreted as a number representation of a date/time object.
<!--- This shows LSDateFormat ---> <html> <head> <title>LSDateFormat Example</title> </head> <body> <H3>LSDateFormat Example</H3> <P>LSDateFormat formats the date portion 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>