Tanveer Jafri
Tanveer Jafri

Reputation: 25

Get month and year as string from mysql date

how can I get month name and year from mysql date datatype my date is stored like 2018-12-18 and I want output as Dec 2018

Upvotes: 1

Views: 270

Answers (2)

KunalS
KunalS

Reputation: 26

SELECT DATE_FORMAT(column_name, "%b %Y") from table_name;

You can also find other date and time functions here

Upvotes: 1

Fahmi
Fahmi

Reputation: 37473

you can try below using date_format() function

SELECT DATE_FORMAT("2018-12-18", "%b %Y");

Upvotes: 1

Related Questions