It seems that when using $this->date to output the date of an calendar event, the output is different regarding which template is used.
For example:
In my event_upcoming.tpl $this->date outputs: 2010-01-10
In my event_default.tpl $this->date outputs: 2010-01-10 (10:00 - 11:00)
Shouldn't $this->date output the same date format?
Anyway, this gives me some problem, because I want to format the time and date to this format (Swedish):
Söndag 10 Januari – Kl 10:00 - 11:00
I have managed to accomplish this in my event_upcoming.tpl by using this code:
Code:
<div class="date"><span class="date">
<?php echo $this->parseDate("l j F", strtotime($this->date)); ?></span>
<?php if ($this->time): ?> – Kl <span class="time"><?php echo $this->time; ?></span><?php endif; ?>
</div>
But I can't really get it to work in my event_default.tpl. Because the date format of $this->date is different in this template, I cannot use the same code.
I found this tutorial on how to separate time and date fields, but it doesn't work. It gives the following error:
Code:
Warning: date_format() expects parameter 1 to be DateTime, boolean given in /public_html/templates/event_default.tpl on line 5
Anyone knows how to get this to work?
And also why the default date format is different in different templates?
Bookmarks