tp5.1 where 时间查询
$where_time = [];
if ($_GET['s_time'] && !isset($_GET['e_time'])){
$where_time = ['add_time','> time' , $_GET['s_time']];
$this->assign('s_time',$_GET['s_time']);
} if ($_GET['e_time'] && !isset($_GET['s_time'])){
$where_time = ['add_time','< time' , $_GET['e_time']];
$this->assign('e_time',$_GET['e_time']);
} if (isset($_GET['e_time']) && isset($_GET['s_time'])){
$where_time = ['add_time','between time' ,[$_GET['s_time'],$_GET['e_time']] ];
$this->assign('e_time',$_GET['e_time']);
$this->assign('s_time',$_GET['s_time']);
} $step = config('page_normal_count');
$model = model('Page');
$start = ($page-)*$step;
$where['is_del'] = self::NOT_DEL;
$banner = model('company'); if($this->admin_user_id != ){
$where['admin_id'] = $this->admin_user_id;
} $result_list = $banner->where($where)
->where($where_time[],$where_time[],$where_time[])
->limit($start.','.$step)
->order('top_time desc,id desc')
->select(); 基于tp5.1 基本的操作 // 大于某个时间 where('create_time', '> time', '2016-1-1');
// 小于某个时间 where('create_time', '<= time', '2016-1-1');
// 时间区间查询 where('create_time', 'between time', ['2015-1-1', '2016-1-1']);
tp5.1 where 时间查询的更多相关文章
- sql时间查询的问题
今天在做一个时间查询的时候遇到一个问题,就是获取的时间是 数据库的存储是这样的2016-10-29 12:11:40 2016-10-31 15:00:05 ... $log=M('table' ...
- mysql根据时间查询前一天数据
MySql数据库如何根据时间查询前一天的数据?本文整理了几个解决方法,有需要的朋友参考下. 本节内容:用MySql怎么根据时间查询前一天的数据. 例1: 代码示例: select * from t ...
- ThinkPHP 数据库操作(四) : 聚合查询、时间查询、高级查询
聚合查询 在应用中我们经常会用到一些统计数据,例如当前所有(或者满足某些条件)的用户数.所有用户的最大积分.用户的平均成绩等等,ThinkPHP为这些统计操作提供了一系列的内置方法,包括: 用法示例: ...
- 【Elasticsearch】ES中时间查询报错:Caused by: ElasticsearchParseException[failed to parse date field [Sun Dec 31 16:00:00 UTC 2017] with format [yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis]];
ES中时间查询报错:Caused by: ElasticsearchParseException[failed to parse date field [Sun Dec 31 16:00:00 UTC ...
- 在数据库中(Oracle),根据时间查询数据: to_date()和to_char()函数
1. to_date() 函数 1.1 格式 to_date("要转换的字符串","转换的格式") //两个参数的格式必须匹配,否则会报错.即按照第二个参数 ...
- 时间查询缺少部分数据 mvc 解决方案
前情提要: 在c# mvc EF模式下 普通的列表展示页面,采用form提交的,后台视同request对象接收,如果涉及到时间搜索的情况,经常会搞错,现在明确一下怎么做. 一:Request /// ...
- Oracle 存储过程判断语句正确写法和时间查询方法
判断语句:if 条件 then if 条件 then ************; elsif 条件 then ************; elsif 条件 then ***** ...
- SqlServer:SqlServer(xpath,字段约束,时间查询,数据文件查询及还原,压缩备份)
1.xpath --1.文档 select @data --2.任意级别是否存在price节点 select @data.exist('//price') --3.获取所有book节点 select ...
- psql的时间类型,通过时间查询
psql的时间类型,通过时间查询 psql有date/timestamp类型,date只显示年月日1999-01-08,而timestamp显示年月日时分秒 1999-01-08 09:54:03.2 ...
随机推荐
- 0020SpringBoot使用SpringCloud中的eureka实现远程调用
要实现远程调用,主要需要三个module:一个注册中心.一个服务提供者.一个服务消费者,然后进行各自的配置和编码,详细内容如下: 1.建一个空的project,创建3各module a.注册中心模块 ...
- [SCSS] SASS dynamic class properties
@mixin generateModifers($property) { #{$property}: $padding; &-large { #{$property}: $padding-la ...
- msf爆破
SSH服务口令猜解: msf > use auxiliary/scanner/ssh/ssh_loginmsf auxiliary(ssh_login) > show optionsmsf ...
- Luogu5540 最小乘积生成树
Luogu5540 最小乘积生成树 题目链接:洛谷 题目描述:对于一个\(n\)个点\(m\)条边的无向连通图,每条边有两个边权\(a_i,b_i\),求使\((\sum a_i)\times (\s ...
- Turn Off Windows Firewall Using PowerShell and CMD
If you want to turn off the Windows Firewall, there are three methods. One is using the GUI which is ...
- DBUtils的最基本的使用
背景 学习了如何连接数据库之后,发现里面进行查询的过程有点麻烦,因此使用DBUtils包来简化操作 配置环境 win10 jdk11 idea mysql8.0.13 jar包 连接数据库的包 c3p ...
- C# 图片进行马赛克处理
MosaicHelper.AdjustTobMosaic( @"C:\Users\xxxue\Desktop\QQ图片20180704142029.jpg", @"C:\ ...
- (转)hadoop 配置文件解释
借鉴:https://blog.csdn.net/wangming520liwei/article/details/78923216 Hadoop 参数配置 详解 一.常用端口 组件 节点 默认端口 ...
- Jira5.2.8 安装
第一步. 安装jira 1. 运行安装包,选择自定义安装 2. 最好使用netstat -ano检查一下端口是否被占用,如果占用就选其他的靓号吧~ 3. 选择集成数据库 输入应用的名称 第二步. 破解 ...
- Java核心复习——J.U.C ArrayBlockingQueue源码分析
介绍 依赖关系 源码 构造方法 public ArrayBlockingQueue(int capacity) { this(capacity, false);//默认构造非公平的有界队列 } pub ...