Copied to clipboard

Flag this post as spam?

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


  • Palle Hansen 143 posts 396 karma points
    Jul 24, 2010 @ 22:29
    Palle Hansen
    0

    Help to date issue

    Hi,

    I'm having problems with a date issue.
    The thing is, that I have to variables datestart and dateend in my xlts.
    I what to only show images that are set between the to dates.

    I'm trying using: umbraco.library:DateGreaterThanOrEqualToday() but with no luck
    I really need at umbraco.library:DateLessThanOrEqualToday() but that doesn't exists :)

    How could I solved this?

     

    My code:
    <xsl:variable name="datestart" select="./data[@alias='wwbanner_aktuel_fra']"/>
    <xsl:variable name="dateend" select="./data[@alias='wwbanner_aktuel_til']"/>

    <xsl:choose>
    <xsl:when test="umbraco.library:DateGreaterThanOrEqual($datestart, $dateend)">
    It's online ow
    </xsl:when>
    <xsl:otherwise>
    It's not online now
    </xsl:otherwise>
    </xsl:choose>

     

    Best regards
    Palle

  • Matt Brailsford 2958 posts 15629 karma points MVP 7x c-trib
    Jul 24, 2010 @ 23:49
    Matt Brailsford
    1

    Hey Palle,

    You could use the umbraco library to get the current date and store it in a variable

    umbraco.library:CurrentDate()

    Then use the DateGreaterThanOrEqual method to check all the dates (not sure on the order, but something like)

    <xsl:variable name="today" select="umbraco.library:CurrentDate()"/>
    <xsl:variable name="datestart" select="./data[@alias='wwbanner_aktuel_fra']"/>
    <xsl:variable name="dateend" select="./data[@alias='wwbanner_aktuel_til']"/>

    <xsl:choose>
    <xsl:when test="umbraco.library:DateGreaterThanOrEqual($datestart, $today) and umbraco.library:DateGreaterThanOrEqual($today, $dateend)">
    It's online ow
    </xsl:when>
    <xsl:otherwise>
    It's not online now
    </xsl:otherwise>
    </xsl:choose>

    Matt

  • Palle Hansen 143 posts 396 karma points
    Jul 25, 2010 @ 21:11
    Palle Hansen
    0

    Hi Matt,

    Thanks, that did the trick.

    Have a great summer :)

    Palle

  • 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