< Umbraco < Reference < umbraco.library

Purpose:

This function allows you to format a date.


Arguments:

FormatDateTime('String Date'-'String Date')
FormatDateTime('String Format')

String Date = d-d
String Format = MMM

String Format Codes:

Month
MMMM = Full month name spelled out ('August')
MMM = Abbreviated month name ('Aug')
MM = 2 digit month ('08')
%M = 1 or 2 digit month ('8')

Day
dddd = Full day of week ('Thursday')
ddd = Abbreviated day of the week ('Thu')
dd = 2 digit day ('06')
d = 1 or 2 digit day ('6')

Year
y or yy = 2 digit year ('99')
yyyy = 4 digit year ('1999')

Hour
h = 1 or 2 digit hour ('9')
hh = 2 digit hour ('09')
H = 24 hour ('21')

Minute
m = 1 or 2 digit minute ('3')
mm = 2 digit minute('03')

AM/PM
tt = AM/PM

RFC-1123 date-time
r = the date-time following the RFC-1123 pattern
For example: Wed, 02 Oct 2002 13:00:00 GMT

Example XSLT Usage:

<xsl:value-of select="umbraco.library:FormatDateTime(@updateDate, 'MMMM d, yyyy')"/>

<xsl:value-of select="umbraco.library:FormatDateTime(@updateDate, 'r') "/>

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.