LSTimeFormat

Formats the time part of a date/time string into a string in a
locale-specific format.
[mask - quicky]
h,hh,H,HH: Hours; m,mm: Minutes; s,ss: Seconds;
l: Milliseconds; t: A or P; tt: AM or PM
"short" = h:mm tt; "medium" = h:mm:ss tt

LSTimeFormat(time [, mask]) → returns String

Member Function Syntax

time.lsTimeFormat([mask])

Argument Reference for the LSTimeFormat function

time

Required: Yes
Values:
  • now()

mask

Required: No
Values:
  • short
  • medium
  • long

Compatibility

ColdFusion:

Member function is available in CF 2016+.

Lucee:

Member function is not available.

Examples sample code invoking the LSTimeFormat function


Tag Example

LSTimeFormat returns a time value using the locale convention.

<!--- loop through a list of locales and show time values ---> 
 <cfloop LIST = "#Server.Coldfusion.SupportedLocales#" 
 index = "locale" delimiters = ","> 
 <cfset oldlocale = setLocale(locale)> 
  <cfoutput><p><B><I>#locale#</I></B> 
 #LSTimeFormat(now())# 
 #LSTimeFormat(now(), 'hh:mm:ss')# 
 #LSTimeFormat(now(), 'hh:mm:sst')# 
 #LSTimeFormat(now(), 'hh:mm:sstt')# 
 #LSTimeFormat(now(), 'HH:mm:ss')# 
 <hr noshade> 
 </cfoutput> 
 </cfloop> 

Fork me on GitHub