$dateTime = new DateTime($event_date);
$event_date = date_format($dateTime, "l n-j-Y g:i A");
I want to put a newline between l(day of week) and a newline between the Y(Year) and g(Hour) Can I do this without putting it in separate variables?
This is to be echoed in html.
You can break the date_format into separate pieces
$event_date = date_format($dateTime, "l") .
"<br/>" .
date_format($dateTime, "n-j-Y") .
"<br/>" .
date_format($dateTime, "g:i A");
You can do the same with a new line character, just substituting \\n for the br tag.
Use /n for a newline character:
document.write("\n");
However, if this is rendering to HTML, you will want to use the HTML tag for a newline:
document.write("<br>");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.