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 ...
随机推荐
- Mac OS下安装MongoDB以及配置方法总结【笔记】
首先打开命令框,输入: brew install mongodb 安装完成后 启动.停止.重启如下 brew services start mongodb brew services stop mo ...
- 【Mac】打开配置文件,添加/修改环境变量
打开文件编辑器: 进入终端,输入open -e .bash_profile或者open -t ~/.bash_profile 打开profile文件 填写配置的环境变量: #示例代码 export ...
- Airtest---UI自动化测试项目
Airtest Project是网易游戏团队新开源出来的一款用于UI自动化测试的项目. testerhome中的文档介绍:https://testerhome.com/topics/12486 官方链 ...
- STM32 HAL库 UART 串口读写功能笔记
https://www.cnblogs.com/Mysterious/p/4804188.html STM32L0 HAL库 UART 串口读写功能 串口发送功能: uint8_t TxData[10 ...
- jquery左划出现删除按钮,右滑隐藏
jquery左侧划出显示删除按钮,右滑动隐藏删除按钮 <!doctype html> <html> <head> <meta charset="ut ...
- bzoj 4240: 有趣的家庭菜园 树状数组+贪心
有一个小性质:就是一个下标排列的最小移动次数就是逆序对数. 我们发现最终形态一定是一个波峰. 那么我们求的就是形成波峰的下标最少逆序对数. 考虑将元素从小到大依次插入. 那么,对于第 $i$ 个元素, ...
- /etc/inittab
# inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON ...
- pyexcel_xlsx
from pyexcel_xlsx import get_data,save_data excel_data = get_data('xxxx.xlsx文件存储位置') #得到的excel_data是 ...
- Codeforces Round #528 (Div. 2)题解
Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc+ ...
- 数据结构实验之图论七:驴友计划【迪杰斯特拉算法】(SDUT 3363)
分析:可以求简单的任意两点间最短距离的稍微变形,一个板子题. #include <iostream> #include <bits/stdc++.h> using names ...