We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36446
    • 184 Posts
    hi!
    I have a question again. Im using ditto as a news snippet, to show recent news in the sidebar. Everything is working nicely but i want to manipulate the date which is shown in the postings. If i crearte a new news document today the date of today is shown. is there a possibility to manipulate that date?
    Thanx for any help!
    cheers
    sven
      https://www.beautyislife-shop.de - premium make-up!
      https://www.topsterne.de - sell it here!
      ---------------------------------------------------------
      • 7231
      • 4,205 Posts
      There are several ways to go about this:
      1) use the date formatting native to Ditto and use the +date+ placeholder in your ditto tpl (note need to use the dateSource parameter as well to define where to get the date);
      2) use PHx within your ditto Tpl to format the date field (phx is installed for use within Ditto as part of ditto);
      3) use a snippet, like the dateTime snippet to format the date.

      In MODx the dates are stored as a unix timestamp and you can format the date as you normally would in php using the stftime() or the date() functions.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 36446
        • 184 Posts
        ok - i managed to do it myself. Just opened phpmyadmin and edited the modx_site_content
        pub_date
        createdon
        editedon
        publishedon
        - the tricky thing is that you have to translate your date to unixtime. This can be done by using this site
        http://www.captain.at/review-unixtime-javascript.php
        cheers
          https://www.beautyislife-shop.de - premium make-up!
          https://www.topsterne.de - sell it here!
          ---------------------------------------------------------
          • 36446
          • 184 Posts
          thanx dev for the reply!
            https://www.beautyislife-shop.de - premium make-up!
            https://www.topsterne.de - sell it here!
            ---------------------------------------------------------
            • 7231
            • 4,205 Posts
            If i crearte a new news document today the date of today is shown. is there a possibility to manipulate that date?
            OK, I understand. You are not refering to the formating but the actual date. By default the createdon date is what is being used otherwise there is the publishedon and the editedon date option.

            You can change the date of the publishedon date by setting the publish date for that document within the manager. Another option is to use a date TV (template variable) and use the date widget to set the date. I use the publish date since it is one of the standard fields available for each document.

            createdon and editedon do not have a widget to set the date, these are set on action create or edit.
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]