We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21417
    • 486 Posts
    Hello,

    I am using EVO 1.0.4 with Ditto 2.1.0.

    I have a tv called "date" that I would like to use for menu sorting.

    The order is correct but the unixtime is listed instead of the dateFormat specified.

    The tv "date" has "input type: date" and "widget: unixtime" selected.

    My ditto call is currently:
    [!Ditto? &startID=`245` &hideFolders=`1` &tpl=`dates-menu-row` &noResults=`dates-menu-NO` &dateFormat=`%A %d, %B %Y` &dateSource=`date` &orderBy=`date ASC`!]
    

    This returns:
    * 1297295940, 5:30pm to 7:00pm
    * 1300925520, 5:30pm to 7:00pm
    * 1311815760, 5:30pm to 7:00pm
    etc

    I would like:
    * Thursday February 10, 5:30pm to 7:00pm
    * Thursday March 24, 5:30pm to 7:00pm
    * Thursday May 26, 5:30pm to 7:00pm
    etc

    I would also really, really like the date number specified as 24th or 26th etc.

    Thanks in advance.
      Web design Adelaide
      http://gocreate.com.au
      • 18913
      • 654 Posts
      I just tried a Ditto call with a tv named "adate"
      [ ! Ditto? &startID=`52` &dateFormat=`%A %B %d, %Y` &dateSource=`adate` &orderBy=`date ASC` ! ]
      


      and got output looking like this
      a new test
      by b e user on Wednesday December 15, 2010
      the summary

      Perhaps the problem is not in your date format?
      Just a thought,
      Matt
      (Evo 1.0.4)
        • 21417
        • 486 Posts
        thanks Matt, but that doesn’t solve the problem at this end.
        any other ideas?
          Web design Adelaide
          http://gocreate.com.au
          • 5340
          • 1,624 Posts
          Hi,

          I suspect a bug in Ditto.

          Try this instead in your chunk

          [+date:date=`%A %B %d, %Y`+]
            • 5340
            • 1,624 Posts
            If the above doesn’t work install PHx and create a custom modifier.

            basically you create a new snippet phx:mydateformat and paste this code

            <?php
            	
            return date('l F jS', $output);
            
            ?>


            and use it like

            [+date:mydateformat+]

            in your chunk

            PS: not tested but you should get the idea
              • 21417
              • 486 Posts
              Hey Cipa,

              That first suggestion works perfectly in the template chunk.

              Now it outputs:
              # Thursday 10 February, 2011, 5:30pm to 7:00pm
              # Thursday 24 March, 2011, 5:30pm to 7:00pm
              # Thursday 26 May, 2011, 5:30pm to 7:00pm

              What’s the trick with getting the th / st / nd to work (eg 10th, 24th, 26th etc)?

                Web design Adelaide
                http://gocreate.com.au
                • 5340
                • 1,624 Posts
                to output st/nd/th you need to use the second method(date php function) because strftime doesn’t know st/nd/th
                  • 21417
                  • 486 Posts
                  Awesome, thanks Cipa, that 2nd method works perfectly with the th/st etc.

                  PM me your paypal and your location and I will hook you up with beer money!

                  Many thanks.
                    Web design Adelaide
                    http://gocreate.com.au