View Full Version : PHP Date function - break line between day and month

03-26-2009, 02:40 PM

How would I modify the following code to make a <br/> between the day and the month?

<?php print(Date("l F d, Y"));?>

This is what I tried, but it still does not work:

<?php print(Date("l"."<br/>". "F d, Y"));?>

03-26-2009, 02:47 PM
'r' in 'br' is interpreted as a fully formatted date. Instead, give it a newline and use nl2br to add it in:

$date = date("l\nF d, Y");
print nl2br($date);

Try that.

03-26-2009, 02:49 PM
print(date("l"."<b\\r/>". "F d, Y")); works for me, don't know how :)

I think \r makes it as a carriage return and escaping again makes it as desired, like the Example #2 at http://php.net/date

03-26-2009, 05:41 PM
Thank you guys - Now I understand, both worked!