Formats date and time values using locale-specific date and time formatting conventions.
LSDateTimeFormat (date , mask) LSDateTimeFormat (date [, mask, locale]) LSDateTimeFormat (date [, mask, locale, timeZone])
LSParseDateTime, LSTimeFormat, DateFormat, SetLocale; Handling data in ColdFusion in the Developing ColdFusion Applications
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:
|
locale |
Locale to use instead of the locale of the page when processing the function. |
<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>