How to get the first monday of given year month.
SET @YearMonth:= '201304';
Result:
2013-04-01 (For April)
2013-11-04 (For November)
Thanks in advance.
Try this
SET @firstday = '2013-04-01';
SELECT ADDDATE( @firstday , MOD((9-DAYOFWEEK(@firstday)),7)) as first_monday;
The param @firstday is the first day of the month you want to search. Note that sunday is the first day of a week, monday is the second day.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With