Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I want to test to see if a node was created within 2 weeks (14 days) of the current date. Is there any way to test if created dates are within a specific range?
Hi Eric - welcome to the forum!
Yes - there are a couple of useful extensions for this, e.g.: DateGreaterThanOrEqual() in the standard extension library for Umbraco.
Only tricky bit is doing the DateDiff duration... I'll see if I can cook up an example for you - but have look at the above first.
/Chriztian
Hi again,
You should be able to test that with the following:
<xsl:variable name="secondsInADay" select="60 * 60 * 24" /> <!-- Grab the year, month and date for today --> <xsl:variable name="today" select="substring-before(umbraco.library:CurrentDate(), 'T')" /> <!-- Do the date/math stuff --> <xsl:variable name="daysSinceCreated" select="umbraco.library:DateDiff($today, substring-before($currentPage/@createDate, 'T'), 's') div $secondsInADay" /> <xsl:if test="$daysSinceCreated <= 14"> <p>New content this is</p> </xsl:if>
Thank you so much! That's exactly what I was looking for. I really appreciate your time and super quick responses!!!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Testing if created date of a node is within a certain range
I want to test to see if a node was created within 2 weeks (14 days) of the current date. Is there any way to test if created dates are within a specific range?
Hi Eric - welcome to the forum!
Yes - there are a couple of useful extensions for this, e.g.: DateGreaterThanOrEqual() in the standard extension library for Umbraco.
Only tricky bit is doing the DateDiff duration... I'll see if I can cook up an example for you - but have look at the above first.
/Chriztian
Hi again,
You should be able to test that with the following:
/Chriztian
Thank you so much! That's exactly what I was looking for. I really appreciate your time and super quick responses!!!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.