mysql 获取任意一个月的所有天数。
SELECT ADDDATE(y.first, x.d - 1) as d
FROM
(
SELECT 1 AS d UNION ALL
SELECT 2 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 5 UNION ALL
SELECT 6 UNION ALL
SELECT 7 UNION ALL
SELECT 8 UNION ALL
SELECT 9 UNION ALL
SELECT 10 UNION ALL
SELECT 11 UNION ALL
SELECT 12 UNION ALL
SELECT 13 UNION ALL
SELECT 14 UNION ALL
SELECT 15 UNION ALL
SELECT 16 UNION ALL
SELECT 17 UNION ALL
SELECT 18 UNION ALL
SELECT 19 UNION ALL
SELECT 20 UNION ALL
SELECT 21 UNION ALL
SELECT 22 UNION ALL
SELECT 23 UNION ALL
SELECT 24 UNION ALL
SELECT 25 UNION ALL
SELECT 26 UNION ALL
SELECT 27 UNION ALL
SELECT 28 UNION ALL
SELECT 29 UNION ALL
SELECT 30 UNION ALL
SELECT 31
) x,
(
SELECT '2018-04-05' - INTERVAL DAY('2018-04-05') - 1 DAY AS first,
DAY(LAST_DAY('2018-04-05')) AS last) y
WHERE x.d <= y.last
mysql 获取任意一个月的所有天数。的更多相关文章
- php时间:获取上一个月,本月天数,下一个月
时间戳转日期 date() 日期转时间戳 strtotime() 当前时间戳time() 获取当前月的天数: $i=; $y=; echo date("t",strtotime(& ...
- mysql 获取最近一个月每一天
select date_add(curdate(), interval(cast(help_topic_id as signed integer) - 30) day) day from mysql. ...
- js获取上一个月、下一个月格式为yyyy-mm-dd的日期
/** * 获取上一个月 * * @date 格式为yyyy-mm-dd的日期,如:2014-01-25 */ function getPreMonth(date) { var arr = date. ...
- js获取上一个月、下一个月
/** * 获取上一个月 * * @date 格式为yyyy-mm-dd的日期,如:2014-01-25 */ function getPreMonth(date) { var arr = date. ...
- JS中在当前日期上追加一天或者获取上一个月和下一个月
/** * 获取上一个月 * * @date 格式为yyyy-mm-dd的日期,如:2014-01-25 */ function getPreMonth(date) { var arr = date. ...
- MySQL查询近一个月的数据
MySQL查询近一个月的数据 近一个月统计SQL select user_id, user_name, createtime from t_user where DATE_SUB(CURDATE(), ...
- js 获取任意一个元素的任意一个样式属性的值
//谷歌,火狐支持console.log(window.getComputedStyle(my$("dv"),null).left);//IE8支持console.log(my$( ...
- js 如何获取某一个月的第一天是周几
js 如何获取某一个月的第一天是周几 calendar ??? padding dates // day = 1 const firstMonthDate = new Date(year + mont ...
- python中获取上一个月一号的方法
业务场景: 我们经常会跑一些月级别或者周级别的报表. 周级别的报表还比较好确定,就是七天前的直接用timedelta(days=7)来获取开始日期就可以了; 但是月级别的报表就要麻烦一些,因为time ...
随机推荐
- cnpm 安装和 command not found
安装cnpm出错 > $ npm install -g cnpm --registry=https://registry.npm.taobao.org 按照淘宝 NPM 镜像安装,cnpm -v ...
- 测试md代码折叠功能
展开查看 System.out.println("Hello to see U!");
- boost variant
Boost Variant resembles union. You can store values of different types in a boost::variant. 1. #incl ...
- c++使用boost库遍历文件夹
1.只在当前目录下遍历 #include <boost/filesystem.hpp> string targetPath="/home/test/target"; b ...
- Linux如何查看进程是否存活
ps -ef | grep nginx ps -ef | grep(过滤) 进程名字
- 接口参数校验之@Valid与BindingResult
接口方法往往需要对入参做一些校验,从而判断入参是否合格,而javax.validation包为我们提供了一些常用的参数校验注解,使用起来很方便. 下面这个示例是检验入参对象中的password是否为空 ...
- React学习笔记-生命周期函数
定义: 生命周期函数指在某一个时刻组件会自动调用执行的函数
- 用C#编写ActiveX控件
http://www.cnblogs.com/homer/archive/2005/01/04/86473.html http://www.cnblogs.com/homer/archive/2005 ...
- 《Spring Cloud构建微服务架构》系列博文示例
SpringCloud-Learning 源码下载地址:http://download.csdn.net/detail/k21325/9650968 本项目内容为Spring Cloud教 ...
- python中的_ElementUnicodeResult是什么
_ElementUnicodeResult在python中是字符串的一种,因为在python3中,字符串就是指以unicode编码规则存储的数据,而以其他方式如utf-8,ASCII编码方式存储的数据 ...