Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

2 Answers 2

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:choose>
    <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>
</xsl:choose>

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

 
discard

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.