If you have tried to use the date output filter and get an empty string, this is why. I found this out when trying to filter the "publishedon" date for a blog entry.
I am referencing this page of the documentation:
http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/commonly-used-template-tags/date-formats
Here they give an "All Parameters" table of string codes you can use to filter the date.
The problem is, some of them don't produce output! And even if you use a "bad" code in combination with other "good" codes, you will still get an empty string.
Here is a specific code being used in a chunk:
<h3>Published: [[+publishedon:strtotime:date=`%D %l:%M%P`]]</h3>
According to the docs, this
should product something like "11/04/14 4:36pm". However, the actual output is an empty string.
The reason I discovered is that some parameters simply don't work, and if you use them, the output is zilch.
I created a snippet to loop through all the parameters and output what they contain and spit out an array of responses. Here is the snippet which I called "TestDate":
$codes = array(
"%a", "%A", "%b", "%B", "%c", "%C", "%d", "%D", "%e", "%H", "%I", "%l", "%j",
"%m", "%M", "%n", "%P", "%p", "%r", "%R", "%S", "%t", "%T", "%u", "%w", "%x",
"%X", "%y", "%Y", "%z", "%Z"
);
$val = array();
foreach ($codes as $c) {
$val[] = "[[*publishedon:strtotime:date=`$c`]]";
}
$result = array_combine($codes, $val);
return "<pre>" . print_r($result, true) . "</pre>";
The result of running this is a test of all individual parameters for the date filter as listed in the docs. Here is the result:
Array
(
[%a] => Mon
[%A] => Monday
[%b] => Oct
[%B] => October
[%c] => 10/6/2014 8:53:00 AM
[%C] =>
[%d] => 06
[%D] =>
[%e] =>
[%H] => 08
[%I] => 08
[%l] =>
[%j] => 279
[%m] => 10
[%M] => 53
[%n] =>
[%P] =>
[%p] => AM
[%r] =>
[%R] =>
[%S] => 00
[%t] =>
[%T] =>
[%u] =>
[%w] => 1
[%x] => 10/6/2014
[%X] => 8:53:00 AM
[%y] => 14
[%Y] => 2014
[%z] => US Mountain Standard Time
[%Z] => US Mountain Standard Time
)
Not only are some codes returning nothing, but other codes don't return what the docs say they should. Look at "%c". This is supposed to return "local date and time" in the format like "Wed jan 7 00:22:10 2010". The actual format looks nothing like what the docs say!
It seems that any code which combines things (except for %c) doesn't work. And shorthand doesn't work either, for example anything removing leading 0s.
It's weird, but I wanted to post these results in case anybody else has this issue with date filter. Hopefully the docs can be updated with a more accurate list!