0

I need to combine this two:

<?= helper('com://site/ohanah.date.format', array('date' => $event->start, 'format' => 'l, j. F Y, H:i','timezone'=>'UTC' )); ?> - <?= helper('com://site/ohanah.date.format', array('date' => $event->end, 'format' => 'H:i','timezone'=>'UTC')); ?>

to be only one PHP line. How can I accomplish this? The Output of this two lines is:

Sonntag, 7. Januar 2018, 19:30 - 20:40

I tried something like this:

<?= 
helper('com://site/ohanah.date.format', array('date' -> $event->start, 'format' -> 'l, j. F Y, H:i' . "-" . -> $event->end, 'format' -> 'H:i','timezone'=>'UTC')); 
?>
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • 1
    How we supposed to know what is `helper()` and how it works? – ArtOsi Dec 20 '17 at 16:15
  • @Tanu I tried something like this: `= helper('com://site/ohanah.date.format', array('date' -> $event->start, 'format' -> 'l, j. F Y, H:i' . "-" . -> $event->end, 'format' -> 'H:i','timezone'=>'UTC')); ?>` but it doesn't work. –  Dec 20 '17 at 16:20
  • If I had to guess, your `helper` function won't be able to format two separate timestamps in a single call. But it's impossible for us to say without the source of the function. – iainn Dec 20 '17 at 16:21
  • @ArtOsi the `helper()` calls the dynamically generated date. What I need to do is just combine this two into one. –  Dec 20 '17 at 16:22
  • `->` looks wrong, should that not be `=>` – RiggsFolly Dec 20 '17 at 16:23
  • Try adding [error reporting](http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php/845025#845025) to the top of your file(s) _while testing_ right after your opening PHP tag for example ` – RiggsFolly Dec 20 '17 at 16:23
  • @RiggsFolly `syntax error, unexpected ''l, j. F Y, H:i'' (T_CONSTANT_ENCAPSED_STRING), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$` –  Dec 20 '17 at 16:25

1 Answers1

0

The solution is this:

<?= helper('com://site/ohanah.date.format', array('date' => $event->start, 'format' => 'l, j. F Y, H:i','timezone'=>'UTC')), ' - ', helper('com://site/ohanah.date.format', array('date' => $event->end, 'format' => 'H:i', 'timezone'=>'UTC')); ?>