SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: date_format

  1. #1
    Colonel Jack O'neill Josh_'s Avatar
    Join Date
    Apr 2004
    Location
    NC
    Posts
    689
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    date_format

    How can I use date_format?

    I have my date inserted using the NOW() function, so it's in yyyy-mm-dd format. I need to use it so it returns it in Month dd, yyyy. For example
    May 18, 2004

    I'm using a SELECT * query, so how could I incoorporate it into that?

    Thanks

  2. #2
    Captain Internet neil's Avatar
    Join Date
    Jun 2001
    Location
    n.ireland
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't use the * in SELECT when using the DATE_FORMAT() command, you'd need to specify them seperately.

    Try this (change the operators I highlighted in bold to what you have set in your database):
    Code:
       SELECT date_format(date_column, '%M %d, %Y') as date FROM table WHERE id='1';
    neil - Geocities, the trailer park of the web
    .<.<.<.<.<.<.<.<
    WEB[retype.net] + [guff.org]
    ICQ[273981] AIM[neiim]

  3. #3
    Colonel Jack O'neill Josh_'s Avatar
    Join Date
    Apr 2004
    Location
    NC
    Posts
    689
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, thanks for your reply. I think that was what I was looking for, I"ll let you know.

    Josh


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
  •