We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    I am outputting user data and want to format the "thislogin" field into DD/MM/YEAR format - currently it chucks out a string of a long number... Any ideas on how to format the [[+thislogin]] code call to make it render as DD/MM/YEAR?

    I tried

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


    but it did not work...

    Cheers


    dubbs.

    This question has been answered by Bruno17. See the first response.

      • 8168
      • 1,118 Posts
      Note - I am using pdoUsers to call in this data - e.g.

      [[!pdoUsers? &groups=`MEMBERS` &tpl=`Tpl-output` &sortdir=`asc` &limit=`100000`]]
      


      The template "Tpl-output"

      [[+thislogin]]
      
        • 8168
        • 1,118 Posts
        Anyone? Surely this is possible? I am a little stumped as to why [[+thislogin:strtotime:date=`%e %B %Y`]] is not working to be honest??? It works in the MODx manager - anyone know where the php template for the edit User view is located? I can then copy how its being used there... e.g. it renders the string into a date format - so it is possible!
          • 8168
          • 1,118 Posts
          MODx core team??? Anyone got the answer for this? Seems a simple one?
          • "thislogin" is already a timestamp, and doesn't need the strtotime modifier.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 8168
              • 1,118 Posts
              Is it??? When it renders into the CSV file I am exporting I get a string - like "1430378328" which should read as "04/30/2015" (like it does in the Manager User view) - It must be possible to change it into DD/MM/YEAR format -as it does it in the manger user view in the Manager???

              Is the issue me calling it in via pdoUsers / and or CSV export??
              • discuss.answer
                • 4172
                • 5,888 Posts
                It is. Exactly what Susan said.

                1430378328


                is a unixtime - timestamp and doesn't need the strtotime modifier, but, of course the other part of your modifier:

                [[+thislogin:date=`%e %B %Y`]]


                if you want it like 04/30/2015, then

                [[+thislogin:date=`%d/%m/%Y`]]
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 8168
                  • 1,118 Posts
                  Thanks Bruno wink Susan's cryptic answer went over my php-newbee head! Thanks for spelling it out for me wink