LSDateFormat

Formats the date part of a date/time value in a locale-specific
format.
[mask - quicky]
d,dd,ddd,dddd: Day of month / week
m,mm,mmm,mmmm: Month; y,yy,yyyy: Year; gg: Period/era string
short / medium / long / full

LSDateFormat(date [, mask]) → returns String

Member Function Syntax

date.lsDateFormat([mask])

Argument Reference for the LSDateFormat function

date

Required: Yes
Values:
  • now()

mask

Required: No
Values:
  • short
  • medium
  • long
  • full

Compatibility

ColdFusion:

Member function is available in CF 11+.

Lucee:

Member function is available in Lucee 4.5+.

Examples sample code invoking the LSDateFormat function


Tag Example

LSDateFormat formats 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> 
 #LSDateFormat(now(), "mmm-dd-yyyy")# 
 #LSDateFormat(now(), "mmmm d, yyyy")# 
 #LSDateFormat(now(), "mm/dd/yyyy")# 
 #LSDateFormat(now(), "d-mmm-yyyy")# 
 #LSDateFormat(now(), "ddd, mmmm dd, yyyy")# 
 #LSDateFormat(now(), "d/m/yy")# 
 #LSDateFormat(now())# 
 <hr noshade> 
 </cfoutput> 
 </cfloop> 

Fork me on GitHub