<xsl:value-of select="ddwrt:Today()">
I would like to add 7 days to the above code. please help
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityHave 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:
number(ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today))))+(864000000000*7)
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;
</xsl:if>
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