Feeds:
Posts
Comments

Archive for June, 2011

To format data in SharePoint I often use xslt. The default formatting of dates however is pretty useless

<xsl:value-of select="@YourDateParam"/>

Results in : 2009-03-23 00:00:00

 

You can also use a predefined locale like this:

<xsl:value-of select="ddwrt:FormatDate(@YourDateParam, 1033, 15)"/>

Results in : Thursay, August 24, 2011 09:00:00 PM

 

If your required date time format is not available, you can also define a custom date time formatting.

<xsl:value-of select="ddwrt:FormatDateTime(string(@YourDateParam) ,1033 ,'dd-MMM-yyyy')" />

Results in : 22-03-2011

<xsl:value-of select="ddwrt:FormatDateTime(string(@YourDateParam) ,1033 ,'dd/MMM/yyyy')" />

Results in: 22/Sep/2011

Other formats

Output Locale Format
3/23/2009 1033 1
3/23/2009 12:00 AM 1033 2
Monday, March 23 2009 1033 3
12:00 AM 1033 4
Monday, March 23, 2009 12:00 AM 1033 7
3/23/2009 12:00:00 AM 1033 13
Monday, March 23, 2009 12:00:00 AM 1033 15
23/03/2009 2057 1
3/23/2009 12:00 AM 2057 2
23 March 2009 2057 3
00:00 2057 4
23/03/2009 00:00 2057 5
23 March 2009 00:00 2057 7
00:00:00 2057 12
23/03/2009 00:00:00 2057 13
23 March 2009 00:00:00 2057 15

Read Full Post »

Follow

Get every new post delivered to your Inbox.