We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22840
    • 1,572 Posts
    Morning, grin

    I am using ditto to pull news articles to the fron page of a site and currently have the created on date showing, however the client wants the date to be the edited date.

    As it stands at the moment it always shows the created date after the doc has been edited.

    Is there a way to display the edited date ??

    Code I’m using

    <div id="[+title+]"><p style="color: #0c2c83; font-weight: bold; font-size: 12px; clear: both;">Published : [+date+] - [+title+]</p>
    <div class="news2">[+content+]</div> </div>
    <div style="width: 600px; height: 1px; border-top: 1px dotted #000; margin: 0 auto; padding-bottom: 10px; text-align: center;"> </div>
      • 4310
      • 2,310 Posts
      Try adding
      &dateSource=`editedon`
      to your snippet call.
      Ditto documentation is here.
        • 22840
        • 1,572 Posts
        Hi,

        Thanks for the answer, I can get the editedon to work but it returns the date of the last edit (in seconds since January 1, 1970) which is not what I want, I just want it to display the date of the edit.

        Thanks for trying grin
          • 6725
          • 12 Posts
          Hi Paul,

          I think you can convert the number of seconds in to a human readable date by using the following in a snippet call :

          return strftime("%d/%m/%y %H:%M:%S", $date);


          Just pass in the date in seconds, and it should return a nicely formatted string that you can use in your ditto template. Been a while since I used it, but I _think_ that’s what I did as I had the same problem.

          HTH
            • 4310
            • 2,310 Posts
            Add
            &dateFormat=`%B %e, %Y`

            to your snippet call
              • 22840
              • 1,572 Posts
              @bunk58
              I now have the following in my snippet call but it’s still displaying in seconds
              [[Ditto? &startID=`1`&tpl=`news_sum`&display=`3`&dateSource=`editedon`&dateFormat=`%B %e, %Y`]] 


              @DavidKay

              Thanks but I no idea where to add that laugh

                • 4310
                • 2,310 Posts
                Strange, works okay for me, I get a date of July, 2008 from the editedon field, when I edit that page it changes to September, 2008.
                Have you cleared the site cache and your browser cache?
                I’m using Ditto 2.0.2
                  • 22840
                  • 1,572 Posts
                  Yep, cleared the cache from modx and my browser and I’m still seeing it in the following format

                  Published : 1221205473 - Thailand Political Situation

                  Also using 2.0.2

                  Thanks for the replys
                    • 22840
                    • 1,572 Posts
                    Whooooo,

                    got it working.

                    Thanks for the help grin