I have a booking system based on Woocommerce and the Woocommerce Bookings plugin. This means essentially I don't have control over the format of the data given to me. At the end of the checkout process I am given a start date and duration for the booking, and I need to display an end date. In theory this is very simple. The data I am given looks like this:
Array ( [Booking Time] => 8:00 am [Duration] => 5 hours )
No nice timestamps to use but I thought date() could easily handle something like this. Here's the code I've used:
date ('h:ia', strtotime(($item['Booking Time'] + $item['Duration'])));
This almost works, the problem is in this case it outputs 01:00am when it should obviously be 01:00pm, so it's getting the hour correct but just not understanding the am/pm switch. What is the best solution here given the data structure I'm being given?