'How can I display all 31 days on the month of march [closed]
I only have Day 1, 3, 9 and 14 on my database. All i want is to display is day 1 - 31 on the month of march
Solution 1:[1]
You can use a recursive CTE to generate all the days of a month:
with recursive march_days as
(select convert('2022-03-01', date) as d
union all
select date_add(d, interval 1 day)
from march_days
where d < '2022-03-31')
select * from march_days;
Solution 2:[2]
Hello and welcome to Stackoverflow.
In php you can get the days with a for loop.
for($i=1; $i<=31; $i++) {
# Do your date things here.
}
That is just a basic counter, without more to go on from your project, code sample etc, then it is unlikely that we will be unable to give you better direction on this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Zakaria |
| Solution 2 | CodingInTheUK |
