<xsl:value-of select="ddwrt:Today()">

I would like to add 7 days to the above code. please help

2 Answers 2


Have you tried

<xsl:value-of select="xs:date(ddwrt:Today()) + xs:dayTimeDuration(7)">

If this didn't work then the next easy approach is to use a Calculated Field and use it in the XSL.


I was able to solve this by adding ticks to Today, for example:


and to check if a field is equal to 7 days from today:

number(ddwrt:DateTimeTick(ddwrt:FormatDate(string($thisNode/@FieldName),1033,1))) = number(ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today))))+(864000000000*7)

and here is my entire xsl:if line:

<xsl:if test="number(ddwrt:DateTimeTick(ddwrt:FormatDate(string($thisNode/@FieldName),1033,1))) = number(ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today))))+(864000000000*7)">
   background-color: #FFFF00;

I was able to find my answer with the help of this forum: https://social.msdn.microsoft.com/Forums/en-US/109ae6f2-ea16-464f-978e-b565a69721a5/sharepoint-designer-2010-determine-if-todays-date-is-within-x-days-of-a-start-date-column-using?forum=sharepointcustomizationprevious

Your Answer

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

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