header
 
     
 
pixel
pixel pixel

Format your dates in your SQL

You don't have to use PHP or ASP to format dates you pull from a database. You can format them 'on the fly' in your SQL query using the DATE_FORMAT function. For example, if your column name is ArticleDate, your query could take the form:
SELECT DATE_FORMAT(articledate,'%a %e %b') as artdate FROM Tablename
The terms %a, %e and %b translate to the abbreviated day of the week (eg - Wed), the date of the month (1 to 31), and the abbreviated month (eg - Dec). Eg - the final result: "Wed 25 Dec". You can display different dates using different terms - see a full list in the MySQL Manual

Unhelpful Helpful Rating 4.0 (score out of 5, no. of ratings: 3)
Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image