getCollectionDatePublic(); $dateFormat not working
Permalink 1 user found helpful
$page->getCollectionDatePublic($dateFormat = 'jS F Y', $type = 'system');
In the documentation it says you can define a $dateFormat using PHP date() format, though it's not working it still prints 2014-10-14 23:48:00
In the documentation it says you can define a $dateFormat using PHP date() format, though it's not working it still prints 2014-10-14 23:48:00
The documentation that you are using is for Concrete 5.6, not 5.7 the getCollectionDatePublic function does not take any parameters in 5.7
I wonder why they took it out?
Anyway one solution is to use php strtotime, I did the following to format the date how I needed it.
Anyway one solution is to use php strtotime, I did the following to format the date how I needed it.
Thanks @andrewhawkes! Was looking for date formatting everywhere! This worked great for the page list block! Appreciate it! Edit: FOR 5.7 *sigh*
The solution from andrewhawkes just gave me the same date on every item in the page list block. I have edited it a little so it works for me (Concrete 5.7.5.3)
1. First I made a copy of the page_list folder in (concrete>blocks) and placed it in (application>blocks).
2. Then I open the folder (application>blocks) and make a new folder "templates"
3. In the folder templates I did make another folder with the templatename.
4. Copy the view.php and view.css into the folder with the themplatename.
5. Delete the rest of the contents so you only have the folder templates in (application>blocks>page_list)
6. Now edit the view.php in the folder (application>blocks>page_list>templates>templatename)
7. Change line 53
To:
To:
And it works! :)
If you want to change the date format you can change d/m/Y to something else.
Look here what to use:http://php.net/manual/en/function.date.php...
1. First I made a copy of the page_list folder in (concrete>blocks) and placed it in (application>blocks).
2. Then I open the folder (application>blocks) and make a new folder "templates"
3. In the folder templates I did make another folder with the templatename.
4. Copy the view.php and view.css into the folder with the themplatename.
5. Delete the rest of the contents so you only have the folder templates in (application>blocks>page_list)
6. Now edit the view.php in the folder (application>blocks>page_list>templates>templatename)
7. Change line 53
$date = $dh->formatDateTime($page->getCollectionDatePublic(), true);
8. Change line 116
<?php echo $date?>
And it works! :)
If you want to change the date format you can change d/m/Y to something else.
Look here what to use:http://php.net/manual/en/function.date.php...
Awesome, that worked for me!
Thanks!! This even works with V8 too.