SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2004
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple date format

    Hey,

    I have in my table a date column. WHen I echo it, it gives me 2005.03.23 . That is good, but I want it to be : 23.03.2005 . It's probably easy, but I haven' t figured it out using the manuals. It's probably me, but if you know how to solve it, let me know.

    I tried

    PHP Code:
    SELECT news_id,title,news,date_format(date,'%d %M %Y')
                                      
    FROM dct_news 
                                      ORDER BY date DESC
                                      LIMIT 5
    "); 
    But that doesn't output anything, empty string.

    Many thanks,
    M
    Last edited by webnology; Feb 26, 2005 at 02:05.

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2004
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, found it. I had to add an alias for the date, now it works.

    PHP Code:
    SELECT news_id,title,news,date_format(date,'%d %m %Y') as outputdate
                                      FROM dct_news 
                                      ORDER BY date DESC
                                      LIMIT 5 
    M


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
  •