End time in a calender

6 posts by 3 authors in: Forums > CMS Builder
Last Post: October 11, 2019   (RSS)

By MercerDesign - October 7, 2019

Hi, I have a calendar and it is working really well but I need to be able to show an end time as well as a start time to an event, I have it got it to show but how can I only show it if an end time is put in?

By gkornbluth - October 7, 2019

Hi,

Not a lot of specifics, and you'd have to check the code and see what format the end time is in, but you could try an if statement in your page that only showed the end time if it was not equal to 0 IE: $your_end_time != "0000-00-00 00:00:00"

Hope that gives you an idea or two.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!

Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By daniel - October 9, 2019

Hi MercerDesign,

I think Jerry has the right idea here. Let me know if you have any more trouble!

Thanks,

Daniel
PHP Programmer
interactivetools.com

By daniel - October 10, 2019

Hi MercerDesign,

For the end date, you should be able to copy how date() and strtotime() is being used to format the start date. Something like this:

<?php echo date("g:i a", strtotime($record['end_time'])) ?>

As well, here's a quick reference for the different formatting codes that can be used in the date() function: https://www.php.net/manual/en/function.date.php

Let me know if that does the trick.

Thanks!

Daniel
PHP Programmer
interactivetools.com

By MercerDesign - October 11, 2019

Perfect, thank you. I did try that before but must have got it in the wrong place. Again, thank you.