Name

LSTimeFormat

Synopsis

                  LSTimeFormat(time [, mask])

Returns locale-specific time formatted according to mask. If no value is specified for mask, LSTimeFormat( ) uses the default locale’s format. Valid entries for mask are the same as for TimeFormat( ). If an invalid mask is passed to the function, ColdFusion outputs the invalid characters. The following example demonstrates for each locale:

<cfset TheTime = Now( )>
   
<cfloop index="locale" list="#Server.Coldfusion.SupportedLocales#">
  <cfset SetLocale(locale)>
  <cfoutput>
    <p><b>#locale#</b><br>
    TheTime = #LSTimeFormat(TheTime)#<br>
    LSTimeFormat(TheTime, 'h:m:s'): #LSTimeFormat(TheTime, 'h:m:s')#<br>
    LSTimeFormat(TheTime, 'h:m:s t'): #LSTimeFormat(TheTime, 'h:m:s t')#<br>
    LSTimeFormat(TheTime, 'hh:mm:ss'): #LSTimeFormat(TheTime, 'hh:mm:ss')#<br>
    LSTimeFormat(TheTime, 'hh:mm:ss tt'): 
      #LSTimeFormat(TheTime, 'hh:mm:ss tt')#<br>
    LSTimeFormat(TheTime, 'H:M:ss'): #LSTimeFormat(TheTime, 'H:M:s')#<br>
    LSTimeFormat(TheTime, 'HH:MM:ss'): #LSTimeFormat(TheTime, 'HH:MM:ss')#<br>
    <p>
    And these formats are new in ColdFusion MX:<br>
    short: #LSTimeFormat(TheTime, 'short')#<br>
    medium: #LSTimeFormat(TheTime, 'medium')#<br>
    long: #LSTimeFormat(TheTime, 'long')#<br>
    full: #LSTimeFormat(TheTime, '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.