Search code examples
phpdatetimejoomladate-format

How to format time in a dynamically generated php description?


I am currently using:

<? JFactory::getDocument()->setDescription($event->title . " am " . $event->start, 'end' -> $event->end) ?>

this generates following:

<meta name="description" content="event title am 2017-12-12 15:30:00">

but I need the time to be in this format:

12.12.2017 um 15:30 Uhr

how can I archive this? I know that the Dates for the Event are rendered with this code:

helper('date.from_till', array('start' => $event->start, 'end' => $event->end, 'format' => $params->date_format))

I would really appreciate your help :)


Solution

  • This Question got answered with another Question: https://stackoverflow.com/a/47752218/8207054


    $doc->setDescription($event->title . " am " . date('d.m.Y', strtotime($event->start)) . ", " . date('H:i', strtotime($event->end)) . " Uhr");