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

    I´m new to MODx, and I´m currently making my first site using it.

    I´ve set up a simple blog, and on the page where you can read the entire blog post (having pressed "read more.."), I currently have the title and content of the blog entry using [*content*] and [*pagetitle*]. The only thing I´m missing is the date. I couldn´t find a [*date*] type tag, or similar. I´ve tried to use a the snippet GetTime, but it only returns 1.january 1970.

    How can I display the date of the document on my page?

    Best Regards,

    Kyle
      • 3232
      • 380 Posts
      you can try using [*createdon*] which will display the date and time the item was created.

      this also might be a valuable resource: http://modxcms.com/document-tvs.html

      -Brian


        • 16512
        • 29 Posts
        Thank you very much for your help!

        But [’createdon*] only returns a very large integer. I found the following on the page you linked to "This is not a "normal" date, and must be processed by a script for meaningful output. Example: strftime("%d/%m/%y %H:%M:%S", $value)"

        I´m afraid I don´t quite understand how I use the script to format the date. Any help would be much appreciated!

        Kyle
          • 3232
          • 380 Posts
          Download and install the following snippet.

          http://modxcms.com/DateTime-884.html

          Once you have that up and running you will want to use it as follows:

          [[DateTime? &format=`%d.%m.%Y` &timestamp=`[*createdon*]`]]

          You can use info found on http://us.php.net/strftime to format it the way you like.

          Let me know how you make out.
            • 16512
            • 29 Posts
            Thank you very much! Worked perfectly!

            Kyle