on 2022 May 17 8:55 AM
Hello,
How I get the first and the last day of current month?
Do you want to get these as dates? Such as:
select ymd(year(current date), month(current date), 1) as FirstDayOfCurrentMonat, cast(dateadd(dd, -1, dateadd(mm, 1, FirstDayOfCurrentMonat)) as date) as LastDayOfCurrentMonth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For those conditions, I often use the dateformat function:
select * from MyTable where dateformat(MyDate, 'yyyy/mm') = dateformat(current date, 'yyyy/mm')
User | Count |
---|---|
73 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.