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?
How to compare dates in xslt? Anybody can answer?
You could use
<xsl:value-of select="umbraco.library:DateGreaterThan('2010-09-02T17:18:31','2010-11-18T11:41:00')"/>
returns false
<xsl:value-of select="umbraco.library:DateGreaterThan('2010-11-18T11:41:00','2010-09-02T17:18:31')"/>
returns true
There's a few static functions available in the umbraco.library class for comparing dates: http://our.umbraco.org/wiki/reference/umbracolibrary and http://umbraco.org/apiDocs/html/AllMembers_T_umbraco_library.htm
Hope this helps.
Regards,
/Dirk
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?
How to compare dates in xslt? Anybody can answer?
You could use
returns false
returns true
There's a few static functions available in the umbraco.library class for comparing dates: http://our.umbraco.org/wiki/reference/umbracolibrary and http://umbraco.org/apiDocs/html/AllMembers_T_umbraco_library.htm
Hope this helps.
Regards,
/Dirk
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.