摘要: http://hi.baidu.com/juntao_li/item/094d78c6ce1aa060f6c95d0bMySQL datediff(date1,date2):两个日期相减 date1 - date2,返回天数。select datediff('2008-08-08', '2008-08-01'); -- 7select datediff('2008-08-01', '2008-08-08'); -- -7一、MySQL 获得当前日期时间 函数1.1 获得当前日期+时间(date + time)函数:now()mys 阅读全文
posted @ 2013-03-05 15:43 蚊子吃青蛙 阅读(141642) 评论(0) 推荐(5) 编辑
摘要: MySQL时间戳转换http://www.cnblogs.com/591wed/archive/2011/11/24/2262031.html1、将时间转换为时间戳select unix_timestamp('2009-10-26 10-06-07')如果参数为空,则处理为当前时间2、将时间戳转换为时间select from_unixtime(1256540102)有些应用生成的时间戳是比这个多出三位,是毫秒表示,如果要转换,需要先将最后三位去掉,否则返回NULL 阅读全文
posted @ 2013-03-05 15:39 蚊子吃青蛙 阅读(522) 评论(0) 推荐(0) 编辑
摘要: Select all rows inserted within the last 24 hours(最近24小时新插入数据):mysql>SELECT * FROM entries WHERE entry_date > UNIX_TIMESTAMP(NOW()) - 86400;Select all rows inserted before 12:00am of the current day(当天12点前插入的数据):mysql>SELECT * FROM entries WHERE date(entry_date) = date(NOW());Determine the 阅读全文
posted @ 2013-03-05 15:37 蚊子吃青蛙 阅读(8958) 评论(0) 推荐(0) 编辑