I'm making a time calculator that adds or subtracts days, hours and minutes from the current time in UTC timezone, or a user-defined date stored in a MySQL database. My current code works, but I haven't been able to figure out how to adjust the time format.
Code:
$days = "+2 days";
$hours = "+1 hours";
$minutes = "+5 minutes";
$time = new DateTime(); // assumes current time
$time->setTimezone(new DateTimeZone('Europe/London'));
$time->modify("$days, $hours, $minutes");
echo $time->format("g:i A l jS F"); // outputs time
Output:
11:48 PM Sunday 4th January
What would be the appropriate formatting to use, to get the interpreter to output the date as "11:48 PM on Sunday the 4th January"? Adding characters like "N" and "J" will mess up (and/or scramble) the date, even when escaped with one or more "\". Strangely enough, this doesn't happen with half the alphabet...
I've been searching the interwebs but haven't found an answer that explains this phenomenon.
Appreciate the help!