Format dates in SQL

Format dates in SQL

Format dates in SQL
Using DATE_FORMAT function ,we can format the date in database.

Example:
SELECT DATE_FORMAT(lastdate,’%a %e %b’) as lastdate FROM user

Using above query, we get ‘MON 08 JAN’ format as result.
The terms %a, %e and %b translate to the abbreviated day of the week , the date of the month , and the abbreviated month respectively.

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.