Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts

    PHP Date function - break line between day and month

    Hi,

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

    PHP Code:
    <?php print(Date("l F d, Y"));?>
    This is what I tried, but it still does not work:
    PHP Code:
    <?php print(Date("l"."<br/>""F d, Y"));?>

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    'r' in 'br' is interpreted as a fully formatted date. Instead, give it a newline and use nl2br to add it in:
    PHP Code:
    $date date("l\nF d, Y");
    print 
    nl2br($date); 
    Try that.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    CaptainB (03-26-2009)

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    PHP Code:
    print(date("l"."<b\\r/>""F d, Y")); 
    works for me, don't know how

    Edit: 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
    Last edited by abduraooft; 03-26-2009 at 05:46 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    CaptainB (03-26-2009)

  • #4
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    Thank you guys - Now I understand, both worked!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •