I have a date picker setup in Fuel with date and time. When the date is updated it updates on the front-end. Right now it's displaying as:
05/06/2016
17:00:00 - 20:00:00
Is there a way to update the date format? I've tried several ways, followed several links, but can't seem to figure it out.
Here is my script inside the template page:
<?php echo fuel_var('event_date'); ?>
<br>
<?php echo fuel_var('start_time', ''); ?> - <?php echo fuel_var('end_time', ''); ?>
Comments
$formatted_date = date('m/d/Y', strtotime($event_date)); // change the format to whatever you want echo $formatted_date;
Do I use the same var function for time? In the database I have them as 'start_time' and 'end_time'.
The time part of it is an admin function I added to Fuel, and it's suppose to display:
5pm - 8pm, rather then 24hour time:
This is what I'm using to display the time on the front end:
<?php echo fuel_var('start_time', ''); ?> - <?php echo fuel_var('end_time', ''); ?>
echo date('h:ma', strtotime($start_time)) .' - '.date('h:ma', strtotime($end_time));
Are you familiar with the different formatters for the date function that is listed above?
http://php.net/manual/en/function.date.php
echo date('ga', strtotime($start_time)) .' - '.date('ga', strtotime($end_time));
Thank you.