Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andres Tenjo 35 posts 55 karma points
    Mar 14, 2011 @ 18:28
    Andres Tenjo
    0

    XSLT if date now between start and end date trouble...

    I don't know how to write this if sentence ... if date now between start and end date

    Like there:

    <xsl:if test="Exslt.ExsltDatesAndTimes:datetime()&gt;./data [@alias='quiz_startdate'] and Exslt.ExsltDatesAndTimes:datetime()&lt;./data [@alias='quiz_endDate'] ">

    Please someone help me !

     

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Mar 14, 2011 @ 20:51
    Chriztian Steinmeier
    1

    Hi Andres,

    There's a useful helper method in umbraco.library for this kind of thing:

    <xsl:variable name="startDate" select="data[@alias = 'quiz_startdate']" />
    <xsl:variable name="endDate" select="data[@alias = 'quiz_endDate']" />
    
    <xsl:if test="umbraco.library:DateGreaterThanToday($endDate)
            and not(umbraco.library:DateGreaterThanToday($startDate))">
        <!-- do stuff -->
    </xsl:if>

    (Dates in XML are just strings and you can't do comparisons like these on them, so need some extensions)

    /Chriztian

  • Andres Tenjo 35 posts 55 karma points
    Mar 14, 2011 @ 21:12
    Andres Tenjo
    0

    Great ! it works :D

    Thank you very much

  • 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.

Please Sign in or register to post replies