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
9thwave
December 29, 2019, 6:42am
2
Could you post your full chunk/snippet code?
Have you tried…
[[+publishedon:date=%Y-%m-%d
]]
1 Like
bobray
December 30, 2019, 6:52am
3
https://community.modx.com/t/pdoresources-and-publishedon-date-formatting/2060/3
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.
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.
lucy
December 30, 2019, 7:47pm
4
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
bobray
December 30, 2019, 8:33pm
5
Thanks – I did not know that.