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

    I used the following tag: [[+tv.publish_date:date=`%d %M %Y`]]
    in order to get a date like that ’21 Jun 2010’
    but the result is ’31 33 1969’.
    The database value is ’2010-06-21 00:00:00’.
    I fill it’s something more about PHP than MODx but in case someone already ran into this problem, I’ll be glad to solve it soon.

    Thank you,

    Thierry.
      • 28215
      • 4,149 Posts
      Try:
      [[+tv.publish_date:strtotime:date=`%d %M %Y`]]
      


      Dates in Revo are not stored as UNIX timestamps, but as actual string dates. Hence the reason just :date doesnt work anymore.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 29861
        • 59 Posts
        Exactly, thanks!
          • 29861
          • 59 Posts
          In fact there’s still a problem: some format keys don’t work like the %M %F (Month in letter) and %l %D (day in letter). Is it a problem in my conf (the date("M F l D") function works in a php file)? or does it comes from MODx?
            • 22303 MODX Staff
            • 10,725 Posts
            This is strftime formatting, not date (I know the filter name is misleading and probably ought to be aliased to strftime).
              • 28948
              • 42 Posts
              To help others: http://php.net/manual/en/function.strftime.php

              I was trying to use %M for a three letter representation of the month, which failed (date formatting). %b was the ticket!
                --
                cal wilson
                oksushi.com
                • 39177
                • 22 Posts
                I also have a nutty one along these lines.

                I have a site built in Revo with a large number of resources that where imported from Evo using the amazing Provisioner plugin.

                This works from some articles:

                [[+publishedon:strtotime:date=`%d/%m/%Y`]]


                But for some reason older resources (I suspect those imported from Evo) the date comes out as 01/05/9540 or 01/05/0 even after opening the resources chaning the date and resaving.

                However this seems to have the opposite effect:

                [[+publishedon:strftime:date=`%d/%m/%Y`]]


                The resources showing incorrect dates now show fine but others so up as 01/01/1970

                Any ideas why?
                  • 39177
                  • 22 Posts
                  OK and what is even more odd is that several of page templates have this:
                  [[*publishedon:strtotime:date=`%b %d, %Y`]]


                  Which seem to consistnetly return the date correctly across all imported Evo docs and new docs.

                  Using the same call in a chunk to list related pages with the + not * returns a mixed update:

                  [[+publishedon:strtotime:date=`%b %d, %Y`]]


                  Examples:

                  Wrong date: Related box in the right hand column of this page: http://www.centreforcities.org/events/2009/09/28/regions-incorporated/
                  Correct date: http://www.centreforcities.org/research/2006/02/22/cityleadership/

                  Does this mean the issue could be with the way publishedon is called?
                    • 39177
                    • 22 Posts
                    The bug is happening in Revo 2.2.6-pl by the way.