Umbraco/Reference/umbraco.library/FormatDateTime
From Wikibooks, the open-content textbooks collection
Contents |
[edit] Purpose:
This function allows you to format a date.
[edit] Arguments:
FormatDateTime('String Date', 'String Format')
String Date = The date you want to format
String Format = a coded string that is an example of the format you want to use (see below)
[edit] 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')
RFC-1123 date-time
r = the date-time following the RFC-1123 pattern
For example: Wed, 02 Oct 2002 13:00:00 GMT
[edit] Example XSLT Usage:
<xsl:value-of select="umbraco.library:FormatDateTime(@updateDate, 'MMMM d, yyyy')"/>
<xsl:value-of select="umbraco.library:FormatDateTime(@updateDate, 'r') "/>