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 count the number of days between now and a date in the future. I can ruddy figure out if I can pass the output of CurrentDate to DateDiff.
Can anyone help?
Yes, that'll work:
<xsl:template match="/"> <xsl:variable name="currentDate" select="substring-before(umbraco.library:CurrentDate(), 'T')"/> <xsl:variable name="futureDate" select="'2011-12-11'"/> <xsl:variable name="diffSeconds" select="umbraco.library:DateDiff($futureDate, $currentDate, 's')"/> <p>Diff in days: <xsl:value-of select="floor($diffSeconds div (60 * 60 * 24))"/></p></xsl:template>
If your date includes a time, then remove the "substring-before" from $currentDate and add a time to the $futureDate, e.g. '2011-12-11T16:00:00'.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Using umbraco.library:DateDiff and CurrentDate
I want to count the number of days between now and a date in the future. I can ruddy figure out if I can pass the output of CurrentDate to DateDiff.
Can anyone help?
Yes, that'll work:
If your date includes a time, then remove the "substring-before" from $currentDate and add a time to the $futureDate, e.g. '2011-12-11T16:00:00'.
is working on a reply...