How to format the date returned from getCollectionDatePublic()

Permalink 1 user found helpful
Does anyone know how to change the format of the date return by this method?

$page = Page::getCurrentPage();
$date = Core::make('helper/date')->formatDate($page->getCollectionDatePublic(), true);
print $date


I would like to add the day to the begining, for example Saturday, 6 June, 2015
or 6 June, 2015.

View Replies:
MrKDilkington replied on at Permalink Reply
MrKDilkington
You can try this.
$c = Page::getCurrentPage();
$datePublic = $c->getCollectionDatePublic();
// Saturday, 6 June, 2015
echo date('l, j F, Y', strtotime($datePublic));
// 6 June, 2015
echo date('j F, Y', strtotime($datePublic));
hissy replied on at Permalink Reply
hissy
Or

$datePublic = $c->getCollectionDatePublicObject()->format('j F, Y');
MrKDilkington replied on at Permalink Reply
MrKDilkington
I don't think I've seen that before.

Thank you, Hissy.