1

Using SharePoint 2013, I have a custom ItemStyle.xsl file where I have the following code:

<div class="articledate">
<xsl:value-of select="ddwrt:FormatDateTime(string(@ArticleStartDate), 1033, 'MMM d')"/>
</div>

It currently shows up as August 18 like this.

enter image description here

What I would like to do is split it up in two - the Month and Day would be separate so I could style them to look like this icon for example.

enter image description here

3
  • 1
    Have you tried <xsl:value-of select="ddwrt:FormatDateTime(string(@ArticleStartDate), 1033, 'MMM')"/><br/><xsl:value-of select="ddwrt:FormatDateTime(string(@ArticleStartDate), 1033, 'd')"/> Aug 30, 2016 at 21:04
  • It worked when I used 'dd' instead of 'd'. It would use the whole date instead. Weird. Sep 1, 2016 at 18:31
  • Cool. You can post your solution as answer. It will help others who are looking for similar solutions. Sep 1, 2016 at 18:33

1 Answer 1

1

I was able to get it to work with the code below using month, day 01-31, and abbreviated name of the day:

<div class="articledate">
<div class="ArticleMonth">
<xsl:value-of select="ddwrt:FormatDateTime(string(@ArticleStartDate), 1033, 'MMM')"/>
</div>
<div class="ArticleDay">
<xsl:value-of select="ddwrt:FormatDateTime(string(@ArticleStartDate), 1033, 'dd')"/>
</div>
<div class="ArticleDDay">
<xsl:value-of select="ddwrt:FormatDateTime(string(@ArticleStartDate), 1033, 'ddd')"/>
</div>
</div>

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.