如何获取 datediff 号

How to fetch datediff number

我遇到了一些问题,我有两个来自日期选择器的日期,然后我想知道两个日期选择器之间的日期范围。

DATEDIFF('2017-04-30','2017-04-01')
Result : 29

输出:

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,
18,19,20,21,22,23,24,25,26,27,28,29,30

感谢您的帮助

我创建了一个table调用tbl Calendar(日历),然后我只需要进行查询

SELECT 
GROUP_CONCAT( DATE_FORMAT(calender, '%d')) ResultDate 
FROM 
calender 
WHERE 
calender BETWEEN '2017-04-01' AND '2017-04-30'

结果:

01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30