We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    Can I use the &dateFormat parameter to format [+unpub_date+] ?

    I use this object to sort the list, this way I can use Ditto as an event calender works great but I would like to see the actual date instead of the unix timestamp.

    how does &dateFormat work? In the documentation I do not see how it works or how to format the date (removing time etc)

    Dimmy

    DittoRulz!!
      follow me on twitter: @dimmy01
      • 11975
      • 2,542 Posts
      Hi dimmy,

      have a look to strftime function => http://www.php.net/manual/en/function.strftime.php
      &dateFormat=`%d %B %Y`

      And to render the transformed date you have to use [+date+] placeholder in your chunk

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 7455
        • 2,204 Posts
        mm is the [+date+] place holder not the creationdate? or can it be any date? if so how would you do that in ditto?
        I am a bit confused.

          follow me on twitter: @dimmy01
          • 11975
          • 2,542 Posts
          The call could look like this:

          [[ditto? &sortBy=`unpub_date` &dateFormat=`%d %B %Y` ]]

          As we apply a specific date format ditto will return the result in a [+date+] placeholder.

          :-)
            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 7455
            • 2,204 Posts
            ok so ditto knows that unpub_date is a date nice.

            works like a charm
              follow me on twitter: @dimmy01