I’m a newbie to Kirby and php, and have inherited a Kirby site that I have been learning how to update. I have created two custom fields (starttime and finishtime) for one of our blueprint pages, which previously used a text field for event time entries. I based the custom fields on the original Kirby time field. I am struggling to properly place the formatting that we want (no leading 0 in 12-format time, and lowercase ‘am’ and ‘pm’ indicators) in my snippets that call up the event content. Here is the snippet code:
<?php $dowMap = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); $dow = strftime('%w', $event->date()); echo $dowMap[$dow] . ' | ' . $event->starttime() . ' - ' . $event->finishtime(); ?>
The starttime and finishtime fields are what I’m looking to format, and I can’t seem to figure out where to place the format characters to make it work. I’m sure my limited php coding experience is making this more difficult than it needs to me. Any help would be greatly appreciated.