Name
LSDateFormat
Synopsis
LSDateFormat(date
[,mask
])
Returns a locale-specific date format according to
mask
. If no value is specified for
mask
, LSDateFormat( )
uses the locale-specific default. Valid entries for
mask
are:
Mask |
Description |
---|---|
d |
Day of the month as a number with no leading zero for single-digit days |
dd |
Day of the month as a number with a leading zero for single-digit days |
ddd |
Three-letter abbreviation for day of the week |
dddd |
Full name of the day of the week |
gg |
Period/era; currently ignored |
m |
Month as a number with no leading zero for single-digit months |
mm |
Month as a number with a leading zero for single-digit months |
mmm |
Three-letter abbreviation for the month |
mmmm |
Full name of the month |
y |
Last two digits of year with no leading zero for years less than 10 |
yy |
Last two digits of year with a leading zero for years less than 10 |
yyyy |
Four digit year |
The following example applies the LSDateFormat( )
function to each locale:
<CFLOOP INDEX="locale" LIST="#Server.Coldfusion.SupportedLocales#"> <CFSET temp = 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> </CFOUTPUT> </CFLOOP>
Get Programming ColdFusion 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.