SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forgive me for posting, because this is probably really simple, but I can't get it to work!

    I'm designing the site so that each user can have their own login and password, which i have done successfully, but now i want to print the current date and time next to their greeting on the front page. I haven't learnt PHP from the basics up (fool that I am), only the bits I have needed to know.

    I've tried searching the manual but can't understand how to call the current date and time into a variable and then print the variable. Yes, I am a buffoon! Any help would be really appreciated ;-)

    Thanks in advance.

    Jon.
    **
    http://paramedicscience.co.uk/

  2. #2
    SitePoint Member
    Join Date
    Sep 2000
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    If you check out http://www.weberdev.com php section and then date/time area then I am sure there will be something
    there that will assist.

  3. #3
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by dolmanboy

    If you check out http://www.weberdev.com php section and then date/time area then I am sure there will be something
    there that will assist.
    Here is the direct URL to the Time & Date section of Weberdev: http://www.weberdev.com/search.php3?...&secondary=PHP

    Here is phpBuilder's code snippet section: http://www.phpbuilder.com/snippet/

  4. #4
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    is this what you need?

    This produces Year-Month-Day
    <?php
    $Today=date("Y-m-d");
    ?>

    This produces Day of week, Name of Month, Day of month, hour, minute and ending with AM or PM
    <?php
    echo("<br><center>");
    print(date("l F d h:i A"));
    echo("</center>");
    ?>

    If the goal is to read the current date into the data base then check the
    tutorial in this site by Kevin Yank. it uses the CURRENT_DATE in one of the input commands in Part 4 and the subsection "inserting data into a data base."

    peace ed



  5. #5
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    a slight mod on my post.

    replace the $today=date(Y-M-D); with print(date(Y-M-D));

    this will cause the date to print, where the provided example sets the string value and does not print out.

    thanks ed

  6. #6
    SitePoint Member
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Everyone, thanks for your help and quick replies! FYI, i've used Ed's print(date("l F d h:i A")); command to produce the output I required, I was trying to use gmdate() to do the same sort of thing but I kept getting errors.

    Once again thanks, nice to know there are people out there willing to help!

    Jon.
    **
    Jon Yates
    w: http://paramedicscience.co.uk/

  7. #7
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Always pleased to be helpful.

    The BIGGEST (and folks will tell you i am not big on using caps), problem I have is around the date and time..

    peace ed


Bookmarks

Posting Permissions

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