Copied to clipboard

Flag this post as spam?

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


  • Peter Alcock 113 posts 176 karma points
    Aug 14, 2013 @ 11:36
    Peter Alcock
    0

    Date difference

    Hi all,

    I having some problems with datediff, i have two dates one of which being currentdate and the other is just from a nodefield.

    What i need is to get the difference between the dates but in the format of days:hours:mins:seconds as a whole, i can get each individual version for example days or minutes but i need it as one string for a countdown jquery plugin.

    Is this possible if so how! Below code is what im using to get the difference in complete days

    <h3>Deal Expires In</h3>

    <xsl:variable name="currentDate" select="substring-before(umbraco.library:CurrentDate(), 'T')"/>

    <xsl:variable name="futureDate" select="umbraco.library:FormatDateTime($currentPage/expireDate, 'yyyy-MM-dd')"/>

      <xsl:variable name="diffSeconds" select="umbraco.library:DateDiff($futureDate, $currentDate, 's')"/>

      <p>Expires in: <xsl:value-of select="floor($diffSeconds div (60 * 60 * 24))"/> days</p>

    Thanks

    Pete

Please Sign in or register to post replies

Write your reply to:

Draft