How to change MySQL date format for database?

前端 未结 6 1663
执念已碎
执念已碎 2020-12-18 07:57

We are using a MySQL database with FileMaker. It appears that when FileMaker is reading the MySQL tables, it will only accept dates in the format of m/d/y.

Is there

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-18 08:02

    I use a WAMP installation and usually simply create a column INT(10) and then store my dates like this:

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

    This stores 2013-11-22 12:45:09 as a number like 1322111245. Yes, it may be considered "improper" but I don't care. It works, and I can sort easily and format on the client any which way I like.

    This is obviously not suggested if you expect to run any other date functions, but for me, I usually just want to know the record's last update and sort a result set by date.

提交回复
热议问题