I’m using the table template add-on to create a custom list of events. I’d like to have a new column that shows the number of days that an event lasts (our courses are 1 – 5 day in length).
I’m guessing that I need to subtract $datetime->start_date_and_time from datetime->end_date_and_time but I’m not having any luck. Any suggestions?
The reason that you’re not able to get those two methods to work in a math equation is because those methods output strings. To do a calculation requires integers, so you could use the get_raw() method to get the timestamps in integers. Or you can use the EE_Datetime class’s length() method and it will return the length of the event’s date time and it will do the calculation for you.
The support post ‘Extracting the event length in days’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.