$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 时间查询的更多相关文章

  1. sql时间查询的问题

    今天在做一个时间查询的时候遇到一个问题,就是获取的时间是 数据库的存储是这样的2016-10-29 12:11:40    2016-10-31 15:00:05 ... $log=M('table' ...

  2. mysql根据时间查询前一天数据

    MySql数据库如何根据时间查询前一天的数据?本文整理了几个解决方法,有需要的朋友参考下.   本节内容:用MySql怎么根据时间查询前一天的数据. 例1: 代码示例: select * from t ...

  3. ThinkPHP 数据库操作(四) : 聚合查询、时间查询、高级查询

    聚合查询 在应用中我们经常会用到一些统计数据,例如当前所有(或者满足某些条件)的用户数.所有用户的最大积分.用户的平均成绩等等,ThinkPHP为这些统计操作提供了一系列的内置方法,包括: 用法示例: ...

  4. 【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 ...

  5. 在数据库中(Oracle),根据时间查询数据: to_date()和to_char()函数

    1. to_date() 函数 1.1 格式 to_date("要转换的字符串","转换的格式")   //两个参数的格式必须匹配,否则会报错.即按照第二个参数 ...

  6. 时间查询缺少部分数据 mvc 解决方案

    前情提要: 在c# mvc EF模式下 普通的列表展示页面,采用form提交的,后台视同request对象接收,如果涉及到时间搜索的情况,经常会搞错,现在明确一下怎么做. 一:Request /// ...

  7. Oracle 存储过程判断语句正确写法和时间查询方法

    判断语句:if 条件 then   if  条件  then ************;   elsif  条件  then  ************;   elsif 条件  then ***** ...

  8. SqlServer:SqlServer(xpath,字段约束,时间查询,数据文件查询及还原,压缩备份)

    1.xpath --1.文档 select @data --2.任意级别是否存在price节点 select @data.exist('//price') --3.获取所有book节点 select ...

  9. psql的时间类型,通过时间查询

    psql的时间类型,通过时间查询 psql有date/timestamp类型,date只显示年月日1999-01-08,而timestamp显示年月日时分秒 1999-01-08 09:54:03.2 ...

随机推荐

  1. 2019-2020-1 20199312《Linux内核原理与分析》第三周作业

    计算机的三大法宝:程序存储计算机.函数调用.中断 堆栈的作用:记录函数调用框架.传递函数参数.保存返回值地址.提供函数内部局部便量的存储空间. 堆栈相关的寄存器 ESP:堆栈指针,指向堆栈栈顶 EBP ...

  2. KM 最大权匹配 UVA 1411/POJ 3565

    #include <bits/stdc++.h> using namespace std; inline void read(int &num) { char ch; num = ...

  3. [CSS] The :empty Pseudo Selector Gotchas

    The :empty pseudo selector selects empty elements. We can use this to display useful messages instea ...

  4. [ARIA] Accessible animations with reduced motion

    Animations can make people sick, or worse! By adding animation toggles and listening in to the user' ...

  5. jquery 使用off移除事件 使用one绑定一次事件,on绑定事件后触发多次相同的事件的异常

    <!-- jquery 移除事件,绑定一次事件,搜狗 one --> <!DOCTYPE html> <html lang="en"> < ...

  6. Oracle 全部后台进程简介

    LGWR,DBWR,SMON,PMON,CKPT是必需的五个后台进程.ARCH是最重要的可选后台进程.最重要的六个进程:1.LGWR重做日志写进程,LOG write 负责将重做日志缓冲区记录顺序写入 ...

  7. 【原创】go语言学习(十三)struct介绍2

    目录: 方法的定义 函数和方法的区别 值类型和指针类型 面向对象和继承 结构体和json序列化 方法的定义 1.和其他语言不一样,Go的方法采⽤用另外一种方式实现. package main impo ...

  8. 启动Django项目报错

    今天一时手欠将电脑名字改成了中文,在启动Django或Flask项目的时候一直报下面的错误 问题描述: 环境配置成功,Django成功pip,运行项目报错,浏览器输入127.0.0.1:8000报错 ...

  9. ROS常用命令

    ROS常用命令 打印ros环境变量 $ echo $ROS_PACKAGE_PATH 确认环境变量已经设置正确 export | grep ROS 环境变量设置文件 sudo gedit ./.bas ...

  10. kafka简介&使用

    架构 几个角色概念 broker 缓存代理,Kafa集群中的一台或多台服务器统称为broker.kafka集群有多个kafka实例组成,每个实例(server)成为broker.每个类型的消息被定义为 ...