That’s it all right... but no day suffix format string :’(
This may be a stupid question, but is it possible for this to be implemented in MODx without also being added to PHP’s strftime? If so, I’m going to get busy with the bugtracker....
Jason
Quote from: kenquad at Oct 28, 2010, 10:50 PM
That’s it all right... but no day suffix format string :’(
This may be a stupid question, but is it possible for this to be implemented in MODx without also being added to PHP’s strftime? If so, I’m going to get busy with the bugtracker....
It’s theoretically possible, but you can also write your own custom output modifier (i.e. snippet). Something like this:
<?php
/* DateSuffix snippet */
$suffix = '';
switch (substr($input, -1, 1)) {
case: '1':
$suffix = 'st';
break;
case: '2':
$suffix = 'nd';
break;
case '3':
$suffix = 'rd';
break;
default:
$suffix = 'th';
}
/* handle anomalies */
switch (substr($input, -2, 2)) {
case '11:
case '12':
case '13':
$suffix = 'th';
break;
}
return $input . $suffix;
Just tack on

ateSuffix after date: (assuming that the number you want to suffix is at the end).
It looks to me like your snippet would require a different condition for every day of the month to differentiate between, say, the 22nd and the 12th, both of which end with the digit ’2’. Is that right?
Jason
Quote from: kenquad at Oct 29, 2010, 10:44 AM
It looks to me like your snippet would require a different condition for every day of the month to differentiate between, say, the 22nd and the 12th, both of which end with the digit ’2’. Is that right?
Not quite, all the ’th’ ones can be left out since that’s the default and you can lump a bunch of them together:
Look above, I’ve rewritten it.
Looks good to me. Now I’ll see if I can get it implemented. Thanks!
Jason
It’s sort of a bug, but not in MODx. The %e modifier is not implemented in Windows.
http://www.php.net/manual/en/function.strftime.php
Thanks for that BobRay.
At least I know I’m not going crazy.
I’m guessing that it might then work when I upload the test site from my windows localhost to the linux server then.
Thanks for your tutorials and info pages - they are very helpful for non-programmer types like me.