str_to_date('2016-08-24', '%Y-%m-%d %H') validStartTime
str_to_date('2016-09-16', '%Y-%m-%d %H') validEndTime

--只有开始日期
select *  from TimeTest t
where t.validStartTime >= str_to_date('2016-08-24', '%Y-%m-%d %H')

--只有结束日期
select *  from TimeTest t
where t.validEndTime<str_to_date('2016-09-16', '%Y-%m-%d %H')

--开始日期,结束日期都有
select *  from TimeTest t
where
t.validStartTime < str_to_date('2016-09-16', '%Y-%m-%d %H')
and t.validEndTime>=str_to_date('2016-08-24', '%Y-%m-%d %H')

MySql开始日期、结束日期查询的更多相关文章

  1. SQL检测开始日期 结束日期 是否存在交叉

    检测开始日期 结束日期 是否存在交叉 "+tj+" and ((starttime>="+starttime+" and starttime<=&q ...

  2. winform datetimepacker 开始日期 结束日期 分类: WinForm 2014-07-15 19:14 124人阅读 评论(0) 收藏

    dtpStart;//开始日期 dtpEnd;//结束日期 1:开始日期小于结束日期 加载dtpEnd的ValueChanged事件即可. //开始日期小于结束日期         private v ...

  3. ExtJs 起始日期 结束日期 验证

    Ext.apply(Ext.form.VTypes,{ daterange: function(val, field) { var date = field.parseDate(val); // We ...

  4. js获得本季度的开始日期 结束日期

    var now = new Date(); //当前日期var nowMonth = now.getMonth()+1; //当前月var nowYear = now.getFullYear(); / ...

  5. java计算当前周开始日期&结束日期

    public static Date getFirstDayOfWeek(Date date) { Calendar c = new GregorianCalendar(); c.setFirstDa ...

  6. SQLSERVER 时间日期函数,查询今天日期、昨天、一个星期、半年前的数据

    今天的所有数据:select * from 表名 where DateDiff(dd,datetime类型字段,getdate())=0昨天的所有数据:select * from 表名 where D ...

  7. mysql 某周的起始和结束日期

    转自:http://bbs.csdn.net/topics/370096126 t_table有数据如下:year    Week2011    22011    32011    42011     ...

  8. 017、MySQL取第4本季度开始和结束日期

    #取第4本季度开始和结束日期 SELECT QUARTER ( adddate( dy, ) ) QTR, date_add( dy, INTERVAL MONTH ) Q_start, adddat ...

  9. Mysql 中的日期时间字符串查询

    一.将数据库中的Date格式的数据,或者指定日期的字符串格式化为想要的样式 DATE_FORMAT (date, format)能根据格式串format 格式化日期或日期和时间值date,返回结果字符 ...

随机推荐

  1. Validation failed for one or more entities.

    验证失败后用DbEntityValidationException 查找出错的字段 try { // Your code... // Could also be before try if you k ...

  2. cWeb开发框架,基于asp.net的cWeb应用开发平台介绍(一)

    cWeb开发框架是基于asp.net的B/S应用开发平台,采用三层架构理论,应用简单.代码简洁.运行快速. cWeb是bubufx提供,是分享资源,无任何版权限制,bubufx继续传承互联网精神,可随 ...

  3. sqlserver 对字符串的SUM

    select id,keyword ,max(Confidence) as confidence, TimeRange=stuff((select ','+rtrim(begintime)+'-'+r ...

  4. storm基础系列之二----zookeeper的作用

    在storm集群中,我们常常使用zookeeper作为协调者.那么具体发挥的是什么作用呢? 概括来说,zookeeper是nimbus和supervisor进行交互的中介.具体来说有二: 1.nimb ...

  5. OAF_开发系列13_实现OAF通过Vector动态查询设置(案例)

    20150715 Created By BaoXinjian

  6. contains 方法

    不管在c#中还是java中,很多类型都有contains方法.它的原理是什么? 看一个java的例子 http://blog.csdn.net/fwwdn/article/details/674684 ...

  7. error: L6235E: More than one section matches selector - cannot all be FIRST/LAST

    解决措施http://blog.csdn.net/chenbang110/article/details/7586244

  8. Spring自定义缓存管理及配置Ehcache缓存

    spring自带缓存.自建缓存管理器等都可解决项目部分性能问题.结合Ehcache后性能更优,使用也比较简单. 在进行Ehcache学习之前,最好对Spring自带的缓存管理有一个总体的认识. 这篇文 ...

  9. Drools mvel方言drl断点调试方法

    开发环境:myeclipse2014,  jdk1.8.0.91,drools6.4.0.Final, drools-eclipse-plugin,mvel2-2.2.6.Final问题描述:drl使 ...

  10. openscales实现漂亮的冒泡效果

    使用的时候openscales 默认的冒泡效果确实有点简陋,想实现那种看着比较舒服的效果,只能自己定义了.参考现有的openscales实现的方式,它是通过控件的状态实现的,每个状态中使用Path绘制 ...