Formatting DateTime in XSL Data View

The default styles for XSL datetime does not include all that is possible. The easiest way to format it is to click on the element in Design view, so that it shows the available formats for Date and for Time.

Once you select something else, it will change the number in the FormatDateTime function from 5 to something like: 'M/d/yyyy HH:mm:ss'

Now you can see what is possible. I needed to get a military time output, so I removed the colons and the seconds from the time.

<xsl:value-of select="ddwrt:FormatDateTime(string(@TimeIncident) ,1033, 'M/d/yyyy HHmm')"/>

You can search this page for instructions on what character combinations are possible for dates and times:

http://msdn.microsoft.com/en-us/library/az4se3k1.aspx

Comments

Popular posts from this blog

SharePoint Designer 2013 Approval Workflow with Comments

Change SharePoint server hostname and Web Application Names

SharePoint Search - Content Processing Pipeline Failed to Process the Item