[Go to] obtain the first day of the current week, month, and quarter in MySQL on the last day. The last day of the current week, month, and quarter in MySQL is taken from: hideto. javaeye. comblog255816 the first day of the current week: selectdate_sub (curdate (), INTERVALWEEKDAY (curdate () + 1DAY) Current week
[Go to] obtain the first day of the current week, month, and quarter in MySQL/the last day of the current week, month, and quarter in MySQL. Part 1: date_sub (curdate (), interval weekday (curdate () + 1 DAY) Current week
[Go to] obtain the first day/last day of the current week, month, and quarter in MySQL
Obtain the first day/last day of the current week, month, and quarter in MySQL: http://hideto.javaeye.com/blog/255816 The first DAY of the current week: select date_sub (curdate (), interval weekday (curdate () + 1 DAY) the last DAY of the current week: select date_sub (curdate (), interval weekday (curdate ()-5 DAY) the first DAY of the previous week: select date_sub (curdate (), interval weekday (curdate () + 8 DAY) the last DAY of the previous week: select date_sub (curdate (), interval weekday (curdate () + 2 DAY) First DAY of the first two week: select date_sub (curdate (), interval weekday (curdate ()) + 15 days) the last DAY of the first two week: select date_sub (curdate (), interval weekday (curdate () + 9 DAY) the first DAY of the current month: SELECT concat (date_format (LAST_DAY (now (), '% Y-% m-'), '01') Last day of the current month: SELECT LAST_DAY (now ()) first day of the previous month: SELECT concat (date_format (LAST_DAY (now ()-interval 1 month), '% Y-% m-'), '01 ′) last day of the previous month: First day of the first two months of SELECT LAST_DAY (now ()-interval 1 month): SELECT concat (date_format (LAST_DAY (now ()-interval 2 month ), '% Y-% m-'), '01') the last day of the first two months: SELECT LAST_DAY (now ()-interval 2 month) the first day of the current quarter: select concat (date_format (LAST_DAY (MAKEDATE (EXTRACT (year from curdate (), 1) + interval QUARTER (CURDATE () * 3-3 month ), '% Y-% m-'), '01') Last day of the current quarter: select LAST_DAY (MAKEDATE (EXTRACT (year from curdate (), 1) + interval QUARTER (CURDATE () * 3-1 month) the first day of the previous quarter: select concat (date_format (LAST_DAY (MAKEDATE (EXTRACT (year from curdate (), 1) + interval QUARTER (CURDATE () * 3-6 month), '% Y-% m-'), '01') the last day of the previous quarter: select LAST_DAY (MAKEDATE (EXTRACT (year from curdate (), 1) + interval QUARTER (CURDATE () * 3-4 month) the first two quarter's first day: select concat (date_format (LAST_DAY (MAKEDATE (EXTRACT (year from curdate (), 1) + interval QUARTER (CURDATE () * 3-9 month ), '% Y-% m-'), '01') Last day of the first two quarter: select LAST_DAY (MAKEDATE (EXTRACT (year from curdate (), 1) + interval QUARTER (CURDATE () * 3-7 month)
?