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

    I have a template variable called eventDate. When I set it to use the Unixtime widget it displays the wrong date.
    For instance on one document I have selected: 13-08-2010 10:38:00

    When using the unixtime widget with ditto as shown below, it outputs as: 31.38.2019

    Here is my Ditto call.

    [!Ditto? &parents=`4` &tpl=`event-tpl` &sortBy=`eventDate` &dateSource=`eventDate` &dateFormat=`%d.%M.%Y` &sortDir=`ASC` !]


    and here is my ditto template:

    <div class="event">
    <h2><span class="date">[+date+]</span> - [+longtitle+]</h2>
    </div>
    


    If I turn off the Unixtime widget it displays the correct date, but my understanding is that it will not sort properly if it’s not in Unixtime. I use a similar method for another section of the site except using the pub_date and it appears to work fine.

    Cheers,
    Jim
      • 26016
      • 561 Posts
      I’ve never gotten the Unixtime widget to work. I just assumed it was borked. It seems to me that widgets tend to be outliers that don’t get much attention. You’ll probably need to hack it or make yourself a snippet.
        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
        • 13505
        • 8 Posts
        Should have checked this first instead of scratching my head for an hour. Turns out my clients host is running PHP4 still, but with the ability to run PHP5 so I added the following line to my .htaccess file to make sure everything was parsed with PHP5 rather than 4.

        AddType x-mapp-php5 .php


        Thanks,
        Jim