pdoResources and publishedon Date Formatting

I am switching from getResources to pdoResources and trying to get the [[+publishedon]] tag to output a properly formatted date. However, since [[+publishedon:strtotime:date=%Y-%m-%d]] does not return anything, I am unsure how to replicate the same output I would get in getResources. I saw in a post saying it does not generate a string and thus strtotime would not work, but no solution was stated.

Thanks!

1 Like

Could you post your full chunk/snippet code?
Have you tried…
[[+publishedon:date=%Y-%m-%d ]]

1 Like

pdoResources won’t recognize that as a publishedon tag. It may pass the tag back, but it won’t contain the date/time.

Here’s something else to try:

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

In theory, pdoResources will replace the publishedon tag, and MODX will handle the output modifier after the time is there. I could be wrong.

PdoTools doesn’t convert dates to strings, so you don’t need to use strtotime. Any date tag you have used with getResources should work with pdoResources simply by removing strtotime.
https://forums.modx.com/thread/101846/pdotools---pdopage-pdoresources-publishedon-createdon-dates-not-displaying-with-formatting

2 Likes

Thanks – I did not know that.