Name
LSDateFormat
Synopsis
LSDateFormat(date
[,mask
])
Returns a locale-specific date format according to
mask
. Dates must be in the range AD
100-9999. If no value is specified for
mask
, LSDateFormat( )
uses the locale-specific default. For valid mask entries, see the
DateFormat( )
function. Dates passed as literals
must be enclosed in quotes. Otherwise, ColdFusion interprets the date
as a numeric date. If an invalid mask is passed to the function,
ColdFusion outputs the invalid characters. For information on how
ColdFusion MX handles two-digit years, see the entry for
CreateDate( )
. The following example applies the
LSDateFormat( )
function to each locale:
<cfloop index="locale" list="#Server.Coldfusion.SupportedLocales#"> <cfset SetLocale(locale)> <cfoutput> <p><b>#locale#</b><br> #LSDateFormat(Now( ))#<br> #LSDateFormat(Now( ), "d/m/yy")#<br> #LSDateFormat(Now( ), "d-mmm-yyyy")#<br> #LSDateFormat(Now( ), 'dd mmm yy')#<br> #LSDateFormat(Now( ), 'dddd, mmmm dd, yyyy')#<br> #LSDateFormat(Now( ), "mm/dd/yyyy")#<br> #LSDateFormat(Now( ), "mmmm d, yyyy")#<br> #LSDateFormat(Now( ), "mmm-dd-yyyy")#<br> short: #LSDateFormat(Now( ), 'short')#<br> medium: #LSDateFormat(Now( ), 'medium')#<br> long: #LSDateFormat(Now( ), 'long')#<br> full: #LSDateFormat(Now( ), 'full')#<br> </cfoutput> </cfloop>
Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.