LSDateTimeFormat

Description

Formats date and time values using locale-specific date and time formatting conventions.

Returns

A formatted date and time value.

Category

Syntax

LSDateTimeFormat (date , mask) 
LSDateTimeFormat (date [, mask, locale]) 
LSDateTimeFormat (date [, mask, locale, timezone])

See also

LSParseDateTimeLSTimeFormatDateFormatSetLocaleHandling data in ColdFusion in the Developing ColdFusion Applications

History

  • ColdFusion (2018 release): Changed parameter name  timeZone  to timezone.
  • ColdFusion (2016 release) Update 3: The masks t and tt return the character string A/P or AM/PM respectively. Use t or tt instead of the mask a.
  • ColdFusion 10: Added the function.

Parameters

Parameter

Description

date

Required. A date/time object, in the range 100 AD-9999 AD.

mask

Optional. Mask that has to be used for formatting. See DateTimeFormat.

timezone

The time-zone information. You can specify in either of the following formats:

  • Abbreviation such as GMT or PST
  • Full name such as Europe/Dublin
    By default, this is the time-zone followed by the system.

locale

Locale to use instead of the locale of the page when processing the function.

Example

<cfset todayDateTime = Now()> 
<body> 
<h3>DateTimeFormat Example</h3> 
<p>Today's date and time are <cfoutput>#todayDateTime#</cfoutput>. 
<p>Using DateTimeFormat, we can display that date and time in different ways: 
<cfoutput> 
<ul> 
<li>#DateTimeFormat(todayDateTime, "yyyy.MM.dd G 'at' HH:nn:ss z")# 
<li>#DateTimeFormat(todayDateTime, "EEE, MMM d, ''yy")# 
<li>#DateTimeFormat(todayDateTime, "h:nn a")# 
<li>#DateTimeFormat(todayDateTime, "hh 'o''clock' a, zzzz")# 
<li>#DateTimeFormat(todayDateTime, "K:nn a, z")# 
<li>#DateTimeFormat(todayDateTime, "yyyyy.MMMMM.dd GGG hh:nn aaa")# 
<li>#DateTimeFormat(todayDateTime, "EEE, d MMM yyyy HH:nn:ss Z")# 
<li>#DateTimeFormat(todayDateTime, "yyMMddHHnnssZ", "English (UK)", "GMT")# 
</ul> 
</cfoutput>

 Adobe

Få hjelp raskere og enklere

Ny bruker?

Adobe MAX 2024

Adobe MAX
Kreativitetskonferansen

14.–16. oktober, Miami Beach og på nettet

Adobe MAX

Kreativitetskonferansen

14.–16. oktober, Miami Beach og på nettet

Adobe MAX 2024

Adobe MAX
Kreativitetskonferansen

14.–16. oktober, Miami Beach og på nettet

Adobe MAX

Kreativitetskonferansen

14.–16. oktober, Miami Beach og på nettet