Search code examples
phpstringjoomlaoperator-keyword

How to set a third operator in a String that adds the Text "Uhr"?


I need to add "Uhr" at the end of the following Code:

<?
$doc = JFactory::getDocument();
            $doc->setTitle($event->title . " | Example");
            $doc->setDescription($event->title . " am " . $event->start, 'end' -> $event->end "uhr needs to be here");
?>

how can I archive this? Because if I add a . "Uhr" it doesn't work :(


Solution

  • $doc->setDescription($event->title . " am " . $event->start . ", " . $event->end . " Uhr");
    

    should do it.

    Formatted dates:

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