LSDateFormat

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.

Syntax

LSDateFormat(date [, mask ])
date

Date/time object in the period from 100 AD to 9999 AD.

mask

Set of characters that are used to show how ColdFusion should display the date:

Usage

When passing date/time value as a string, make sure it is enclosed in quotes. Otherwise, it is interpreted as a number representation of a date/time object returning undesired results.

Examples

<!--- 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 possible locales and
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>       



1