ZF2查询具有datetime列的DATE()的WHERE子句 [英] ZF2 Query WHERE clause with DATE() for datetime column

查看:139
本文介绍了ZF2查询具有datetime列的DATE()的WHERE子句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含datetime数据类型的列,我想在Zend Framework2中构建一个SQL查询,将日期部分与用户输入日期进行比较。



需要构建类似的部分为DATE(datetime列)='2014-09-16'with;
$ select-> where();



将非常感谢有人可以帮助这个。

解决方案

使用如下:

  $ date ='2014.05.24' 
$ select-> where('date(expecting_date)='。$ date。'');


I have a column with datetime data type and I want to build a SQL query in Zend Framework2 which compare date part with user input date.

Need to build similar part as DATE(datetime column) = '2014-09-16' with; $select->where();

would be very grateful if someone could help on this.

解决方案

Use like this:

$date = '2014.05.24';
$select->where('date(expecting_date) = "'.$date.'"');

这篇关于ZF2查询具有datetime列的DATE()的WHERE子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆