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 9 of 9
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need to Post the Current Date in my Page

    Guys, how can i do this in PHP?

    <<<< Today is Day, Month Date, Year >>>

    Tnx.

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Welcome here !

    check out http://www.php.net/manual/en/function.date.php for all possible date-pars in all possible forms.

    you'll need something like

    PHP Code:
    echo ('<<<< Today is' date ("d, m, Y") . ' >>>>'); 
    Last edited by raf; 04-05-2004 at 12:35 PM.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi, you need to do it slightly differently to that:

    PHP Code:
    <?php
    echo "<<< Today is Day ".date("d").", Month ".date("m").", Year ".date("Y")." >>>";
    ?>
    Like raf said, you can lookup the possible letters on the php.net link that he gave you.

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by missing-score
    hi, you need to do it slightly differently to that:

    PHP Code:
    <?php
    echo "<<< Today is Day ".date("d").", Month ".date("m").", Year ".date("Y")." >>>";
    ?>
    Hmm. Different reading. I thought the Day etc needed to be replaced by the day. Maybe he just needs
    PHP Code:
    echo('<<<< Today is Day, Month Date, Year >>>'); 


    php_stud,

    if the url and posted code doesn't get you there, post an example of the exact format you want it to be printed.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    raf: What i meant was not the format, but in your code you put:

    PHP Code:
    <?php
    date 
    (dmY);
    ?>
    Which isnt going to work becuase you have 3 arguments, none of which are strings, and the date function has 2 arguments... The first argument has the format and the second (an optional timestamp).

    Or just thought, maybe im reading it wrong and you meant:

    PHP Code:
    <?php
    date
    ("d, m, y");
    ?>
    (either way, you still missed some quotes

  • #6
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    eek. Indeed. Missed the quotes. (old age ... bad eyes ... to much wine ...) I've edited the code i posted to avoid confusion.

    thanks missing-score.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #7
    New Coder
    Join Date
    Apr 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a million... this is the format that I prefer...

    echo "Today is ".date("l").", ".date("F")." ".date("d").", ".date("Y");

  • #8
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry, wanted to make new thread. this is a dummy edit
    "There is more than one way to do it."

  • #9
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by php_stud
    Thanks a million... this is the format that I prefer...

    echo "Today is ".date("l").", ".date("F")." ".date("d").", ".date("Y");
    this is a bit shorter and more efficient
    PHP Code:
    echo 'Today is 'date("l, F d, Y"); 
    Last edited by raf; 04-06-2004 at 07:35 AM.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

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