Spec-Zone.ru › ColdFusion

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, locale]) → returns string

Member Function Syntax

time.lsTimeFormat([mask])

  • CF
  • Lucee
  • BL 1.0.0+
  • See Also: lsDateFormat timeFormat

    Argument Reference

    time date
    Required

    mask string
    Default: short

    Values:
    • short
    • medium
    • long

    locale string

    Geographic/language locale value, where the format is a combination of an ISO 639-1 code and an optional ISO 3166-1 code separated by a dash or an underscore.
    Values:
    • en
    • de_DE
    • de_CH
    • ...

    Compatibility

    ColdFusion:

    Member function is available in CF2016+.

    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> 

    Script Example using specific locale

    lsTimeFormat returns a time value using the specified locale.

    writeDump(lsTimeFormat(now(), 'short', 'en_US'));

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/lstimeformat

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API