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 try to compare two dates and always get false.
<xsl:variable name="now" select="Exslt.ExsltDatesAndTimes:datetime()" />
<xsl:value-of select="string(data[@alias='contentDate'])" />return 2010-11-18T11:41:00<xsl:value-of select="string($now)" />return 2010-09-02T17:18:31
<xsl:value-of select="string(data[@alias='contentDate']) < string($now)" />return false
<xsl:value-of select="string(data[@alias='contentDate']) > string($now)" />return false
Why the last is false?
Hi AlexR,
Unfortunately you can't compare strings this way in XSLT - there's a couple of comparison functions available in the umbraco.library namespace, e.g.:
<xsl:value-of select="umbraco.library:DateGreaterThanOrEqualToday(data[@alias = 'contaentDate'])" />
/Chriztian
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
How to compare dates
I try to compare two dates and always get false.
<xsl:variable name="now" select="Exslt.ExsltDatesAndTimes:datetime()" />
<xsl:value-of select="string(data[@alias='contentDate'])" />
return 2010-11-18T11:41:00
<xsl:value-of select="string($now)" />
return 2010-09-02T17:18:31
<xsl:value-of select="string(data[@alias='contentDate']) < string($now)" />
return false
<xsl:value-of select="string(data[@alias='contentDate']) > string($now)" />
return false
Why the last is false?
Hi AlexR,
Unfortunately you can't compare strings this way in XSLT - there's a couple of comparison functions available in the umbraco.library namespace, e.g.:
/Chriztian
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.