How to format a date field in MYSQL

Everything,

I need to get the date in a specific format in MYSQL. For instance,

it should return month / year (10/2009).

My version is MYSQL 5.1.

Thanks, Srinivasan.

+1
source share
5 answers

Function DATE_FORMAT

DATE_FORMAT(col,'%m/%Y') 
+3
source

Check the documentation for this function in MySQL

DATE_FORMAT (date, format)

 DATE_FORMAT(col, '%m/%Y') 
+1
source
 date_format(yourdatefield, '%c/%Y') as formatted_date 

will do it - http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format

+1
source

For IIS, I just use the function:

 FUNCTION mySLQDate(xdate) IF xdate <> "" THEN mySLQDate = year(xdate) & "/" & month(xdate) & "/" & day(xdate) END IF END FUNCTION 
+1
source

use function DATE_FORMAT

http://www.mysqlformatdate.com helps you use the function correctly

+1
source

Source: https://habr.com/ru/post/1381608/


All Articles