I want my DateOfBirth inside a Table to be displayed in dd/mm/yy format. I know we can retrieve dates in different format. But how could I change the format in the table itself?
Why would you bother how it is stored? Just turn it to whatever format you need when retrieving it. If for some reasons you need a formatted version there just place it in a varchar column and apply custom format while inserting. Just mind that this way any date operations on it become harder and incredibly inefficient.
You can do it like this SQLFIDDLE
SELECT DATE_FORMAT(dates, '%D of %M, %Y') FROM datetbl;
Reference https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.