SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I am trying to accomplish is identify when the modfied date of a record is current to 6 days old, 7 to 13 days old and then older than 13 days.

Is there an easy way to do this?

share|improve this question

In the XSL of your DVWP, establish a variable that is a formatted date of the modified column. Do the same for today's date. Then figure out the equation to test it. Then perform a when/otherwise to decide what to display.

<xsl:variable name="modifiedDate" select="ddwrt:FormatDate(string(@Modified), 1033, 1)" />
<xsl:variable name="todaysDate" select="ddwrt:FormatDate(string(Today()), 1033, 1)" />
    <xsl:when test="$todaysDate &lt;= ($modifiedDate  + 6)">6 days old</xsl:when>
    <xsl:when test="($todaysDate &lt;= ($modifiedDate  + 13)) and ($todaysDate &gt;= ($modifiedDate + 6))>7-13 days old</xsls:when>
    <xsl:otherwise>More than 13 days old</xsl:otherwise>

I'm not sure if this is the exact syntax but this is the theory you need to get it working.

share|improve this answer
Date math in XSLT is ridiculously more difficult than the syntax provided above... – iOnline247 Dec 6 '11 at 0:29
This is true. I didn't test the code. It's more of a theory to find the right syntax than a literal solution. – Josey Dec 6 '11 at 20:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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