How to change MySQL date format for database?

We use a MySQL database with FileMaker. It appears that when FileMaker reads MySQL tables, it will only accept dates in m / d / y format.

Is there a way to get our MySQL database to change the default format to m / d / y instead of YYYY-MM-DD?

I know that I can use the DATE_FORMAT () function for individual SELECT queries, but I want to see if I can just change the default formatting.

+5
source share
6 answers

Change 1

Reading a little more, I found that you can change the format for a specific field , but not recommended.

ALLOW_INVALID_DATES , .

, select DATE_FORMAT(), , , , .

+9

MySQL ( ), , , .

:

SELECT date_format(mydatefield,'%m/%d/%Y') as mydatefield FROM mytable

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

, , , : mm/dd/yyyy - - - ; dd/mm/yyyy. - , "12/05/2010"? , , , .

, , . , .

+4

, MySQL.

, date_format datetime_format, , , , , " ".

+1

WAMP INT(10), :

UPDATE  `test` SET  `dateandtime` = DATE_FORMAT( NOW(),  '%y%m%d%H%i' ) WHERE `id` =1234;

2013-11-22 12:45:09 , 1322111245. , "", . , , .

This is clearly not recommended if you expect to run any other date functions, but for me I usually want to find out the latest record update and sort the result by date.

0
source
SELECT COUNT(field_name) AS count_it FROM table_name WHERE DATE_FORMAT(date_field,'%Y-%m-%d') = DATE_FORMAT(CURDATE(), '%Y-%m-%d')-- to count records for today.
0
source
SELECT DATE_FORMAT(NAME_COLUMN, "%d/%l/%Y %H:%i:%s") AS 'NAME'
0
source

All Articles