Redbean O/RM store “date” as varchar(255)?

别等时光非礼了梦想. 提交于 2019-11-30 13:54:01
Sirber

found this: http://groups.google.com/group/redbeanorm/browse_thread/thread/6961ac635e6886f6

The Optimizer will now convert columns with datetime values to datetimefields. If a different value is inserted the column will be reverted by OODB in fluid mode.

Looks like you need to be very specific in the format for a datetime column. For instance, the following code should provide a date/time column:

$mysqldate = date("Y-m-d", $your_date); // for date column
OR
$mysqldatetime = date("Y-m-d H:i:s", $your_date_time); // for datetime column

Specifically, "Y-m-d" for date, and "Y-m-d H:i:s" for datetime, are the formats RedBean is looking for.

You can either use time() or change the column type after freezing the DB.

The Standard Optimizer handles DateTime columns. You can check it out here: http://redbeanphp.com/#/Plugins (almost at the end of the page)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!