We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49177
    • 6 Posts
    Good Day.
    MODX Evo 1.0.12

    I want to display pub. date in human-readable format.
    What i do:

    [+pub_date:strtotime:date=`%e %B %Y`+]


    Result: 1 Jan 1970.
    For all posts.

    But [+pub_date+] display right date in unix time (if i convert it) and all post has right pub dates (in unix time).
    Can someone help me with it?

    Thanks and sorry for my English.
      • 46886
      • 1,154 Posts
      Wow! You found a solution to this trouble?

      I found this bug before, when using the discuss forum software. I wanted the user registration date, and it always came out the same value. I tried everything, and thought the value was not being set at all.

      But you can get the right date in unix time? Can you show me how to convert it some something readable?

      I have discussed this several times with users here, but we never found a solution.

      Also, I don't think this is an Evo only problem, because I am using Revo, but that doesn't matter.

      So, what are you trying to do now? Can you show what you got now?
        • 49177
        • 6 Posts
        Thanks for unswer.
        Now i use

        [+pub_date:strtotime:date=`%e %B %Y`+]


        And got

        1 Jan 1970

        If this problem is so big, i think i make custom snippet to convert unix time to redable data and releas it where.
        I think i do it tomorow.
          • 49177
          • 6 Posts
          Ok, now i make some shitcode and its work wink

          In my Chunk:
          [[dateFormatter &unixDate=[+pub_date+]]]


          And created new simple Snippet:
          <?php
          if(!isset($unixDate))
          		return false;
          
          	echo date('d.m.y', $unixDate);
          ?>


          Now i hav date in normal format.
            • 47079
            • 3 Posts
            Hey,
            Are you working on Windows or Linux maybe? I found this:

            http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/commonly-used-template-tags/date-formats

            Look at the last paragraph (the FYI) and mind the last remark:

            So the first 3 common examples given do not work on Windows!

            Hopefully this helps -- maybe try something like %d %m %Y.

            Let me know!
              • 47079
              • 3 Posts
              Hey,
              Are you working on Windows or Linux maybe? I found this:

              http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/commonly-used-template-tags/date-formats

              Look at the last paragraph (the FYI) and mind the last remark:

              So the first 3 common examples given do not work on Windows!

              Hopefully this helps -- maybe try something like %d %m %Y.

              Let me know!
              • [+pub_date:strtotime:date=`%e %B %Y`+]

                If [+pub_date+] is already in unix time, you shouldn't be adding strtotime there as that takes a date string and turns it into a unix timestamp. Simply do this:

                [+pub_date:date=`%e %B %Y`+]
                  Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                  Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                  • 46886
                  • 1,154 Posts
                  Wow that's so cool! I hope I can use it to add in the user's registration date into the user profile page!

                  Thanks antik3!