I am making a time calculator that adds or subtracts days, hours and minutes from the current time to the UTC time zone or user-specified date stored in the MySQL database. My current code works, but I was not able to figure out how to set the time format.
The code:
$days = "+2 days";
$hours = "+1 hours";
$minutes = "+5 minutes";
$time = new DateTime();
$time->setTimezone(new DateTimeZone('Europe/London'));
$time->modify("$days, $hours, $minutes");
echo $time->format("g:i A l jS F");
Conclusion:
11:48 PM Sunday 4th January
What would be the appropriate formatting to force the interpreter to display the date as "11:48 p.m. Sunday, January 4"? Adding characters such as "N" and "J" will ruin (and / or scramble) the date, even if you escape with one or more "\". Oddly enough, this does not happen with half the alphabet ...
I searched for interwebs but did not find an answer explaining this phenomenon.
Appreciate the help!