The mysql database I set up used date format for the field. Consequently dates have to be entered as 0000-00-00. So when I retrieve the field name news_date from the database it will print as 2011-02-02. I would like to display it as February 2, 2011. Can someone help me with the code to make this happen? Thanks.
printman55 0 Light Poster
Recommended Answers
Jump to PostSELECT DATE_FORMAT( curdate( ) , '%M %e, %Y' ) AS showdate
or in php you can get by using,
date("F j, Y", strtotime($res['news_date']));
Jump to PostJust replace the $next_date with php date function as below,
Print "<tr><td class='ParaText' align='left' valign='top'>Date</td><td class='ParaText'>".date("F j, Y", strtotime($news_date)) ."</td><td class='ParaText' align='left' valign='top'>" .$news_text ."</td></tr>";
All 5 Replies
dietdew12z 8 Junior Poster
paulrajj 6 Junior Poster
printman55 0 Light Poster
dietdew12z 8 Junior Poster
paulrajj 6 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.