SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2000
    Location
    Seattle, WA area
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a date associated with an article in my MySQL database and I would like it to display the date stored with that article on my PHP page as something like "December 25, 2000" instead of "2000-12-25" which is how MySQL likes to pull it.

    I've tried:
    Code:
    echo( $postdate("l, F dS Y.") );
    but it doesn't work. (In the above example, $postdate is the date of the article in MySQL standard form (I'm assuming).

    Can anyone help me? Thanks.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $data = explode("-", $postdate);
    $utime = mktime(0,0,0,$data[1],$data[2],$data[0]);
    print DATE("l, F jS, Y");
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi freddydoesphp

    Just what I wanted to know!!!! Absolutely

    Thanks and peace

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    another option is to use DATE_FORMAT in your MYSQL query:
    DATE_FORMAT("2000-12-25","%M %e, %Y")
    and it will give you:
    December 25, 2000
    DATE_FORMAT() is introduced with MYSQL 3.21.14
    Great Dane
    Gokhan ARLI

  5. #5
    SitePoint Zealot
    Join Date
    Sep 2000
    Location
    Seattle, WA area
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freddydoesphp
    $data = explode("-", $postdate);
    $utime = mktime(0,0,0,$data[1],$data[2],$data[0]);
    print DATE("l, F jS, Y");
    That didn't work. It displayed today's date instead....

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Damn my mistake sorry
    $data = explode("-", $postdate);
    $utime = mktime(0,0,0,$data[1],$data[2],$data[0]);
    print DATE("l, F jS, Y", $utime);
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    SitePoint Zealot
    Join Date
    Sep 2000
    Location
    Seattle, WA area
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That one works great. Thanks.


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
  •