http://toptree.iteye.com/blog/812642今天,在开发邮件系统的时候发现有很多的邮件没有发送成功,想手动把数据修改。找了mysql 的日期函数

获得的pubtime为String型,在sql语句中用mysql的时间函数date_format('time','format')转换:

String sqlstr="select * from do_document where

pub_time<date_format('"+pubtime+"','%Y-%m-%d %H:%i:%s') order by pub_time desc limit 0,1";

然后执行该sql语句就查到了满足条件的记录。

用法:

  select count(*)  from MESSAGE where date_format(sendTime,'%Y-%m-%d') = '2010-11-16'  

       SELECT COUNT(*) from test_table where  activityid in (-1,4)  and weibotime < STR_TO_DATE('2011-09-01 00:00:00', '%Y-%m-%d %H:%i:%s')

mysql 时间函数date_format的更多相关文章

  1. sql的日期和时间函数–date_format

    Mysql的日期和时间函数–date_format   DATE_FORMAT(date,format)依照 format 字符串格式化 date 值.下面的修饰符可被用于 format 字符串中:修 ...

  2. Mysql时间函数

    http://blog.sina.com.cn/s/blog_6d39dc6f0100m7eo.html mysql中函数和关键字不区分大小写.下文函数的datetime参数处既可以用时间字符串也可以 ...

  3. mysql时间函数和时间操作

    补 原文链接:http://blog.csdn.net/yuxiayiji/article/details/7480785 select timediff('23:40:00', ' 18:30:00 ...

  4. MySQL 时间函数加减计算

    一.MySQL 获得当前日期时间 函数 1.1 获得当前日期 + 时间(date + time) 函数:now() mysql> select now();+———————+| now() |+ ...

  5. joda-time的简单使用及mysql时间函数的使用(今天,本周,本月)

    近期在做一些首页的统计数据复习了下mysql的时间函数,以及后续修改成 传入时间查询时使用的joda-time 软件简介 JodaTime 提供了一组Java类包用于处理包括ISO8601标准在内的d ...

  6. MySQL时间函数,用起来比PHP还爽

    前一篇写了PHP的时间函数(还是草稿),这一篇就写Mysql的时间函数吧.最近做的项目,关乎权限,于是自然而然的就与有效期联系在了一起.其中有一个功能是生成特殊表格,可以根据用户的选择,按周.月.季. ...

  7. mysql 时间函数 时间转换函数

    时间函数 Now 获取当前时间 current_timestamp 获取当前时间 localtimestamp 时间转换 UNIX_TIMESTAMP    "2009-09-15 00:0 ...

  8. mysql时间函数操作

    Mysql时间转换函数 https://blog.csdn.net/w_qqqqq/article/details/88863269 mysql时间日期函数 https://www.cnblogs.c ...

  9. mysql 时间函数转换

    1 NOW() //当前时间 2 SYSDATE() //当前时间 3 CURRENT_TIMESTAMP 4 以'YYYY-MM-DD HH:MM:SS'或YYYYMMDDHHMMSS格式返回当前的 ...

随机推荐

  1. webRTC前世今生

    WebRTC 的前世今生 本文由 rwebrtc 翻译 WebRTC 技术是激烈的开放的 Web 战争中一大突破.-Brendan Eich, inventor of JavaScript 无插件实时 ...

  2. ci支持pathinfo

    location ~ \.php { #去掉$ root H:/PHPServer/WWW; fastcgi_pass ; fastcgi_index index.php; fastcgi_split ...

  3. mongoDB最新版安装

    转载自:http://www.higis.org/2012/04/25/ubuntu-install-mongodb/ ubuntu上安装mongodb本可以直接通过sudo apt-get inst ...

  4. 学习 表单验证插件validate

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. LeetCode OJ-- Recover Binary Search Tree ***@

    https://oj.leetcode.com/problems/recover-binary-search-tree/ 一棵二叉搜索树,二叉搜索树的特征是,中根遍历的话,得到的序列是递增的 题目中, ...

  6. Codeforces 901C Bipartite Segments(Tarjan + 二分)

    题目链接  Bipartite Segments 题意  给出一个无偶环的图,现在有$q$个询问.求区间$[L, R]$中有多少个子区间$[l, r]$ 满足$L <= l <= r &l ...

  7. 《HelloGitHub》第 38 期

    兴趣是最好的老师,HelloGitHub 就是帮你找到兴趣! 简介 分享 GitHub 上有趣.入门级的开源项目. 这是一个面向编程新手.热爱编程.对开源社区感兴趣 人群的月刊,月刊的内容包括:各种编 ...

  8. svn报“Previous operation has not finished; run 'cleanup' if it was interrupted”的错误

    -.叙述 今天需要更新接口文檔,所以就update了一下,結果報了如下錯誤:      Error : Previous operation has not finished; run 'cleanu ...

  9. noip2017集训测试赛(六)Problem A: 炮艇大赛之正式赛

    题目描述 给定一个长度为\(L \le 10^9\)的环形赛道, \(n \le 10^5\)个人在上面赛艇. 每个人的速度都不相同, 假如为正则顺时针走, 否则逆时针走. 当两个人相遇时, 他们就会 ...

  10. 2016北京集训测试赛(十七)Problem B: 银河战舰

    Solution 好题, 又是长链剖分2333 考虑怎么统计答案, 我场上的思路是统计以一个点作为结尾的最长上升链, 但这显然是很难处理的. 正解的方法是统计以每个点作为折弯点的最长上升链. 具体的内 ...