How to format the date returned from getCollectionDatePublic()

Permalink 3 users 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.

 
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 Best Answer 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.
PaiviK replied on at Permalink Reply
PaiviK
THANK YOU!!!!!