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, locale]) → returns string

Member Function Syntax

date.lsDateFormat([mask, locale])

Argument Reference

date date

The datetime object

mask string
Default: medium

A keyword or custom combination of components
  • short
  • medium
  • long
  • full

locale string

CF 8+ Locale to use instead of the locale of the page when processing the function



Member function is available in CF11+.


Member function is available in Lucee4.5+.

Sample code invoking the lsDateFormat function

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)> 
 #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")# 
 <hr noshade> 

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub