Forum

Thread tagged as: Question, Events

Change default event calendar clock format

Hi!

I'm using the events app, and I would like to know how i could change the time format that the calendar uses to display time. For instance, if I add an event X at the starting time 15h, in the calendar that same event will show up as 3:00 X, and i would like it to show up as 15:00 X.

Here is my code for the main php:

 perch_events_calendar(); 

And here is my code for the calendar template:

<div style="margin: auto; text-align: center; background: rgba(255,255,255,0.7);">
<h2><perch:events id="selected_month" format="%B %Y" /></h2>
<ul class="calendar-nav">
   <a href="?d=<perch:events id="current_month" format="Y-m" />"><perch:events id="current_month" format="%b %Y" /></a>
   <a class="paging-next" href="?d=<perch:events id="next_month" format="Y-m" />"><perch:events id="next_month" format="%b %Y" /><img src="img/next.png"/> </a>
</ul>
</div>
<table id="calendar" class="calendar table-condensed table-bordered table-striped" style="margin: auto;">
    <thead>
    <perch:events id="header" encode="false" />
    </thead>
    <tbody>
        <perch:events id="body" encode="false" />
    </tbody>
</table>
Gustavo Bica

Gustavo Bica 0 points

  • 5 years ago

For future reference,

To accomplish what i wanted i just needed to change the event-day.html template to this:

<perch:before>
    <div class="eventwrap">
    <span class="day"><perch:events id="eventDateTime" format="j" /></span>
</perch:before>

<div class="vevent event">
    <a href="<perch:events id="eventURL" />"><span class="time dtstart"><span class="value-title" title="        <perch:events id="eventDateTime" format="%c" />"><perch:events id="eventDateTime" format="%#H:%M %P" />   </span> </span>
    <span class="summary <perch:events id="category_slugs" />"><perch:events id="eventTitle" /></span>
    </a>
</div>
<perch:after></div></perch:after>
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can also add your X to the format attribute.