Use Date_format
, i.e.
select date_format(fieldname,'%Y%m%d') from ...;
You can find more information in the manual at http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format
Simple way to check from the command line:
select date_format(now(),'%Y%m%d');
This just formats today as CCYYMMDD.
1
solved Convert MYSQL date to CCYYMMDD