Can MySql database server store date value in mm-dd-yyyy format?
Can MySql database server store date v开发者_运维百科alue in mm-dd-yyyy format?
Not as a native DATE
column: Those are always represented as YYYY-MM-DD
.
However, you can use DATE_FORMAT()
to output the date in any format you like.
SELECT DATE_FORMAT(column, "%m-%d-%Y");
Dates are stored as dates, not strings.
They are not stored in any specific format.
You can retrieve dates in a variety of formats by calling DATE_FORMAT
.
You can change the date format client side like this:
mysql> set date_format = '%m-%d-%Y';
How the database actually stores the dates should be irrelevant.
No mysql cannot store date in that format. It can store dates only in the yyyy-mm-dd format. u change the format of the data to be inserted or extracted from the mysql db.
精彩评论