SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    date time question

    I have always needed to put a date stamp on a website and used this:
    PHP Code:
    <?php echo date('d of F, Y',time());
    So it would add this: 28 of January, 2005.
    However, recently I just dropped out the time() function to this php string and get the same thing
    PHP Code:
    <?php echo date("d of F, Y");
    I am unsure how or why I used the time() function to do this task.. can anyone clear me up on why this would be needed or not needed?

  2. #2
    SitePoint Zealot ssttoo's Avatar
    Join Date
    Jan 2004
    Location
    LA, California
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the second date()'s parameter is optional and if not supplied, it defaults to time()

  3. #3
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might need to use second parameter in case, say you have stored date in database and then you want to format that date. SO, to format a date which is not current you would need to supply second parameter.

    Note: while accessing from database there are other functions in mysql which can format date. so, its upto you. But, if you use those functionthen later on decide to change database then those function might not work.


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
  •