Looking at that, $joke is an array. format() is a method belonging to a class.
The entry in the $joke array with the index jokedate is an object of the same class that format() belongs to.
Is that all correct?
I guess not, I think jokedate is a string, not an object. But you are trying to call a function on that string as if it were an object with the format() method in its class.
Aha, thanks, so… If I get it right, then I’m going to ask this: In what example scenario might it really be initiated using a Date literal and not using a string?
So if you want to use dates from the database as objects then you need to convert them to objects. It’s actually very simple:
// let's assume $joke['jokedate'] contains
// date string from db like '2018-02-18':
$joke['jokedate'] = new DateTime($joke['jokedate']);
echo htmlspecialchars($joke['jokedate']->format('jS F Y'),ENT_QUOTES,'UTF-8');