Display MySQL date with short name using query

To display a MySQL date with a short month name, such as “Jan” for January, we have to use the DATE_FORMAT() function with the %b format specifier.

Here is an example using SQL Query:

Code

SELECT DATE_FORMAT('2025-10-10', '%d-%b-%Y');

This SQL query will return the date in the format “10-Oct-2025”.

We can also include other short names, such as the abbreviated weekday name, using the %a specifier:

SQL Code

SELECT DATE_FORMAT('2025-10-10', '%a, %d %b %Y');

This query would return “Fri, 10 Oct 2025”.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *