We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47562
    • 113 Posts
    Sorry, this was a silly question, as pubdate is not a date at all, but a string; I need to just rearrange the info in that string...


    If I use the [[+pubdate]] placeholder in my tpl to getFeed, I receive the default formatting. I'd like to change that format.

    Would something like this work for an RSS item?
    [[*publishedon:strtotime:date=`%B %e, %Y`]]


    Thanks! [ed. note: pauhana last edited this post 12 years, 3 months ago.]
      • 40045
      • 534 Posts
        • 47562
        • 113 Posts
        Ah, good to know.

        I had gone with using sscanf to chop things up and rearrange them, but I'd definitely prefer sticking with a standard filter/modifier...

        Thanks much!
          • 3749
          • 24,544 Posts
          If it's a placeholder, it will need to be like this, otherwise you'll get the date of the page with the aggregator tag (e.g., getResources) for every doc:

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


          Note that the date modifier calls strftime() not date(). The format tokens are not the same. The ones you want are here: http://us1.php.net//manual/en/function.strftime.php

          Also, you may already know this, but pub_date and publishedon are not the same pub_date contains a future publication date and is usually cleared when the doc is published. The publishedon field holds the date that the doc last changed from unpublished to published (or the date it was created if it started out published).

          Whether it works or not will depend on the parsing order, so you'll have to try it to see.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 47562
            • 113 Posts

            Thanks Bob.

            Actually, what I'm dealing with is neither "publishedon" nor "pub_date", but rather the pubDate as it's reported within the feed xml:

            <pubDate>Tue, 10 Jun 2014 22:04:42 +0000</pubDate>


            I'm gonna tinker with things a bit, but it may turn out to be safest if I just deal with the value at the string level...

            Cheers!